Java Assert Equal assertEquals(String expected, String actual)

Here you can find the source of assertEquals(String expected, String actual)

Description

assert Equals

License

Open Source License

Declaration

private static void assertEquals(String expected, String actual) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static void assertEquals(String expected, String actual) {
        if (expected == null && actual != null || expected != null && !expected.equals(actual)) {
            throw new AssertionError("Expected: " + coalesce(expected) + ", actual: " + coalesce(actual));
        }/*from  www  .  j a  v  a 2s.c  o  m*/

        System.out.println("Passed: " + coalesce(actual));
    }

    private static String coalesce(String s) {
        return s != null ? "'" + s + "'" : s;
    }
}

Related

  1. assertEquals(Object expected, Object actual)
  2. assertEquals(Object o1, Object o2)
  3. assertEquals(Object obj1, Object obj2, String errMsg)
  4. assertEquals(Object obj1, Object obj2, String message)
  5. assertEquals(Object val1, Object val2)
  6. assertEquals(String expected, String current)
  7. assertEquals(String message, Object expected, Object actual)
  8. assertEquals(T expected, T actual)
  9. assertEqualsAny(Object obj1, Object[] objects, String errMsg)