Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In CacheRegionClearStatsDUnitTest, I kept the use of Cache for the client. I also left the test using deprecated Cache.createRegion, AttributesFactory and CacheServer.setNotifyBySubscription. Updating it to use ClientCache and non-deprecated APIs is desirable but out of scope for this how-to. 

18) (optional) update from raw types to generics if possible

19) (optional) update all variable names and method names to avoid single-letter, confusing names or abbreviations

20) (optional) replace use of org.junit.Assert with use of AssertJ

AssertJ provides much better failure messages that will make dealing with test failures much easier in the future. It also provides richer handling of expected exceptions than JUnit.

21) consider using CacheServer.setPort(0) instead of getRandomAvailablePort and then use CacheServer.getPort() to discover what port it randomly used

2219) reorganize test so that vars and Rules are at the top, Before and After methods come before tests, Test methods come next, then any private methods used by the tests and finally any inner classes at the bottom of the class

...