The difference between the assertTrue method and the assertEquals method of Assert in junit jar package
Problems encountered in unit testing:
1. AssertEquals (true, check.isSatisfied (data, "4", null, null)
2. Assert.assertTrue (check.isSatisfied (data, "4", null, null)
Both statements can be run correctly if the class under test has no logic errors, but if the class under test has logic errors or other problems, it cannot return true correctly:
1. The first sentence is a good hint.
"expected: but was:"
two。 But the second statement only gives AssertionFailedError:null
It is easy to misunderstand that there is a null value in the object of the written unit test case, but no null value is found; in fact, there is a problem with the tested class.
It is recommended to do a good job with the first statement for unit test, junit4 new assertThat method, you can also try to use.