@Test public void localConfigurationWillWorkInDerivedClass() { final TestCaseChild testCase = new TestCaseChild(); // setupParent is in parent testCase.setupParent(); final Tour generatedTourParent = testCase.generateParent(); assertEquals( "generated from parent: parent configuration should be applied", TestCaseParent.OBJECTS_IN_COLLECTION, generatedTourParent.getStops().size()); final Tour generatedTourChild = testCase.generateChild(); assertEquals( "generated from child: parent configuration should be applied", TestCaseParent.OBJECTS_IN_COLLECTION, generatedTourChild.getStops().size()); }
@Test public void localConfigurationCanBeOverridenInDerivedClass() { final TestCaseChild testCase = new TestCaseChild(); testCase.setupParent(); testCase.setupChild(); final Tour generatedTourParent = testCase.generateParent(); assertEquals( "generated from parent: child configuration should have no effect on how parent's generation is done", TestCaseParent.OBJECTS_IN_COLLECTION, generatedTourParent.getStops().size()); final Tour generatedTourChild = testCase.generateChild(); assertEquals( "generated from child: child configuration should override parent's configuration", TestCaseChild.OBJECTS_IN_COLLECTION, generatedTourChild.getStops().size()); }