TestNG 6.8.8
I have the following interface and implementation:
public interface HolderService {
String str();
//other-methods
}
public interface Act1{
public String action(Collection<HolderService> context);
}
//The action class for testing
public class ActImpl implements Act1{
public String action(Collection<HolderService> context){
//implementation
}
}
The problem is the implementation of the HolderService
is kind of messy to initialize it with test data which makes the test be quite large.
So my first thought was to write a simple test implementation and supply it with test data like this:
public class ActImplTest{
@Test
public void some_Test(){
//...
}
private static class ServiceHolderTestImpl implemets HolderService{
//Just a JavaBean with getters and setters
}
}
But it looks a little wierd that in order for to make tests look simpler I need to provide some test implementation. Maybe there is another way to deal with the problem. I also looked at Parametrization, shown in this example, but it doesn't seem fit my needs.