Converting a DUnit test from JUnit 3 to JUnit 4: 1) extend *JUnit4DistributedTestCase* or *JUnit4CacheTestCase* 2) remove constructor(String name) 3) *import static com.gemstone.gemfire.test.dunit.Assert.*;* 4) annotate test class directly with *@Category(DistributedTest.class)* 5) annotate all test methods with *@Test* (even the disabled ones!) 6) annotate disabled test methods with *@Ignore(“include bug # and/or comment”)* 7) remove *import junit.framework.AssertionFailedError* 8) replace any custom usage of *AssertionFailedError* with *AssertionError*
After committing GEODE-1050 to develop, you can now convert any DUnit test from JUnit 3 to JUnit 4 by following the above steps. I’ve already converted the following as examples: geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheCloseDUnitTest.java geode-core/src/test/java/com/gemstone/gemfire/cache30/CachedAllEventsDUnitTest.java geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java The JUnit3 and JUnit4 implementation classes are currently under com.gemstone.gemfire.test.dunit.internal.*. Now that I everything merged to develop I’ll probably follow up with a bit more refactoring but I'd like to hear feedback from others first. -Kirk
