June 2025
Intermediate to advanced
1129 pages
53h
English
Static methods with the pattern “parameter provides the input, return value provides the result” are easy to test. These methods don’t change any environment, and states don’t exist. The test case merely examines the return, which is easy. Testing gets more complex when the thing to be tested entails extensive system changes: Has a file been created? Are things in the database as desired? Has the cluster mirrored the data to other servers? Does an external program provide the expected return? Does a native method really return what it promises, without crashing the JVM?
If things suddenly become untestable, then a bad design has been revealed. This problem often happens because a class has too many ...
Read now
Unlock full access