Junit Method

上一篇 / 下一篇  2011-12-20 17:10:07 / 个人分类:junit

StatementDescription
fail(String)Let the method fail. Might be used to check that a certain part of the code is not reached. Or to have failing test before the test code is implemented.
assertTrue(true) / assertTrue(false)Will always be true / false. Can be used to predefine a test result, if the test is not yet implemented.
assertsEquals([String message], expected, actual)Tests that two values are the same. Note: for arrays the reference is checked not the content of the arrays.
assertsEquals([String message], expected, actual, tolerance)Test that float or double values match. The tolerance is the number of decimals which must be the same.
assertNull([message], object)Checks that the object is null.
assertNotNull([message], object)Checks that the object is not null.
assertSame([String], expected, actual)Checks that both variables refer to the same object.
assertNotSame([String], expected, actual)Checks that both variables refer to different objects.
assertTrue([message], boolean condition)Checks that the boolean condition is true.

TAG:

 

评分:0

我来说两句

Open Toolbar