Assert: assertEquals(int expected, int actual) : TestCase « junit.framework « Java by API






Assert: assertEquals(int expected, int actual)

 



import junit.framework.TestCase;

public class TestLargest extends TestCase {
  public TestLargest(String name) {
    super(name);
  }

  public void testAdds() {
    assertEquals(2, 1 + 1);
    assertEquals(4, 2 + 2);
    assertEquals(-8, -12 + 4);
  }
}

   
  








Related examples in the same category

1.extends TestCase
2.Assert.fail(String message)
3.Assert: assertEquals(Object expected, Object actual)
4.Assert: assertEquals(String expected, String actual)
5.Assert: assertEquals(String message, double expected, double actual, double precision)
6.Assert: assertFalse(String message, boolean value)
7.Assert: assertNotSame(String message, Object expected, Object actual)
8.Assert: assertNull(String message, Object value)
9.Assert: assertSame(String message, Object expected, Object actual)
10.Assert: assertTrue(String message, boolean value)