I have some common set up code that I’ve factored out to a method marked with @Before. However, it is not necessary for all this code to run for every single test. Is there a way to mark it so the @Before method only runs before certain tests? Answer Just move out the tests that don’t need the setup code
Tag: unit-testing
Checking the results of a Factory in a unit test
I have developed some classes with similar behavior, they all implement the same interface. I implemented a factory that creates the appropriate object and returns the interface. I am writing a unit test for the factory. All you get back is an interface to the object. What is the best way to test that the factory has worked correctly? I