You can find all my video tutorials on test driven development using java in youtube.
Continue reading…
You can find all my video tutorials on test driven development using java in youtube.
Continue reading…
When you work with legacy codebase, sometime you would like to avoid the call to super constructor and super methods so that you can focus on covering sub class. package com.ourownjava.tdd.jmockit; /** * * @author Sanju Thomas * */ public class BaseClass { public BaseClass(final String name){ throw new IllegalArgumentException(name); } } package com.ourownjava.tdd.jmockit; /** […]
Continue reading…
As part of the initial screening, Bank Of America asked me to solve a kata recently. I have written a simple but test driven solution for them. The kata and the solution can be found here. Complete source code in Github
Continue reading…
Junit test parallel execution can bring down the test execution time considerably. The only condition is that your test cases must be independent. The state shall not be shared across test cases. Today, I shall share a maven project with parallel test execution configured using maven surefire plugin. The complete source code can be found […]
Continue reading…
In today post, I would give you a simple example to demonstrate the use of @Tested annotation and use of invocation count in the expectation block to avoid explicit verification. @Tested annotation would initialize the field of the class under test and wire the dependencies by type. In the example given below, the fileService field […]
Continue reading…
While you test using mocks it would be necessary sometime to capture the arguments passed into mocked behavior. JMockit Verification.withCapture method can be used to capture the argument passed into a mocked behavior. The complete source code for this article can be found in the github package com.ourownjava.tdd.mockit; import javax.naming.AuthenticationException; /** * * @author […]
Continue reading…
In certain scenarios like if we have no control or handle of argument passed into a mock we can use Mockito ArgumentCaptor to verify if certain arguments where passed to mocks. The complete source code used in this article can be cloned from github package com.ourownjava.tdd.mockito.capture; /** * * @author Sanju Thomas * */ public […]
Continue reading…
In the previous post I shared a sample program to mock exception conditions using JMockit. Today we will look into exception mocking with Mockito. As I mentioned in the earlier post, during the development time, testing an exception scenario without the help of the second party/third party service developer is not an easy task. However […]
Continue reading…
In today’s post I would talk about mocking exceptions using JMockit. You would like to test exception scenarios, especially when you deal with third party services. This will help you to fine tune your code to deal with the exception. During the development time testing an exception scenario without the help of the second party/third […]
Continue reading…
Recently one of the companies asked me to solve Vending Machine Kata given here (https://github.com/guyroyse/vending-machine-kata) as their first level of screening. Though I couldn’t solve it completely in less than three hours I have covered most of the usecases. You can find my solution here. (https://github.com/sanjuthomas/vending-machine) You will have to add logic to complete the […]
Continue reading…