Mega Code Archive

 
Categories / Java Tutorial / JUnit
 

AssertEquals([String message],expected,actual,tolerance)

check that the actual result is equal to 3.33,  but only look at the first two decimal places: import junit.framework.TestCase; public class TestLargest extends TestCase {   public TestLargest(String name) {     super(name);   }   public void testEmpty() {       assertEquals("Should be 3 1/3", 3.33, 10.0/3.0, 0.01);   } }