Java Assert Equal assertEquals(Object obj1, Object obj2, String errMsg)

Here you can find the source of assertEquals(Object obj1, Object obj2, String errMsg)

Description

assert Equals

License

Open Source License

Declaration

public static void assertEquals(Object obj1, Object obj2, String errMsg) 

Method Source Code

//package com.java2s;

public class Main {

    public static void assertEquals(Object obj1, Object obj2, String errMsg) {

        if (obj1 == null) {

            assertNull(obj2, errMsg);//from w w w. ja v a 2 s .  co  m
            return;
        }

        if (!obj1.equals(obj2)) {

            throw new RuntimeException(errMsg);
        }
    }

    public static void assertNull(Object object, String errMsg) {

        if (object != null) {

            throw new RuntimeException(errMsg);
        }
    }
}

Related

  1. assertEquals(Object a, Object b, String msg)
  2. assertEquals(Object exp, Object actual)
  3. assertEquals(Object expected, Object actual)
  4. assertEquals(Object expected, Object actual)
  5. assertEquals(Object o1, Object o2)
  6. assertEquals(Object obj1, Object obj2, String message)
  7. assertEquals(Object val1, Object val2)
  8. assertEquals(String expected, String actual)
  9. assertEquals(String expected, String current)