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






Assert: assertEquals(Object expected, Object actual)

 

import static org.junit.Assert.assertEquals;
import junit.framework.JUnit4TestAdapter;

import org.junit.Test;

public class Main{

  public static void main (String... args) {
    junit.textui.TestRunner.run (suite());
  }
  
  public static junit.framework.Test suite() {
    return new JUnit4TestAdapter(Main.class);
  }
  
  @Test public void testCopy() {
    assertEquals(12, 12);
    assertEquals(12L, 12L);
    assertEquals(new Long(12), new Long(12));

  }
}

   
  








Related examples in the same category

1.extends TestCase
2.Assert.fail(String message)
3.Assert: assertEquals(String expected, String actual)
4.Assert: assertEquals(String message, double expected, double actual, double precision)
5.Assert: assertEquals(int expected, int actual)
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)