Hi all,
I would like to know how many
JUnit test classes can one write for a class. Recently I had to test my class which has 2 methods. I want to test method-1 with only one scenario: mean the method expects few mocks. I want to test method-2 with set of mocks.
For this I created 2 test classes one which tests method-1 and other which tests method-2. The Test class which tests method-2 is actually a parametrized class where I initialize an array which has 5 set of values.
Then I heard that we should not create 2 test classes for one
java class because it messes the code coverage.
If I have to combine the two test classes then I have to write 6 methods. Or I have to find some way to have parametrized constructor and a default constructor and somehow train JUnit to test it.
Can anyone please help me. Thank you all in advance.