Java Assert Equal assertEqualsToStringBuilder(final StringBuilder errorMessageHolder, final String currentEM, final Object expected, final Object actual)

Here you can find the source of assertEqualsToStringBuilder(final StringBuilder errorMessageHolder, final String currentEM, final Object expected, final Object actual)

Description

assert Equals To String Builder

License

Open Source License

Declaration

public static void assertEqualsToStringBuilder(final StringBuilder errorMessageHolder, final String currentEM,
            final Object expected, final Object actual) 

Method Source Code

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

public class Main {
    public static void assertEqualsToStringBuilder(final StringBuilder errorMessageHolder, final String currentEM,
            final Object expected, final Object actual) {
        if (expected == null) {
            if (actual != null) {
                errorMessageHolder.append(currentEM);
                errorMessageHolder.append(": ");
                errorMessageHolder.append("expected: <null>");
                errorMessageHolder.append("but was: <");
                errorMessageHolder.append(actual);
                errorMessageHolder.append(">\n");
            }//  www  .  j ava  2s  . c  o m
        } else {
            if (!expected.equals(actual)) {
                errorMessageHolder.append(currentEM);
                errorMessageHolder.append(": ");
                errorMessageHolder.append("expected: <");
                errorMessageHolder.append(expected);
                errorMessageHolder.append('>');
                errorMessageHolder.append("but was: <");
                errorMessageHolder.append(actual);
                errorMessageHolder.append(">\n");
            }
        }
    }
}

Related

  1. assertEquals(String expected, String actual)
  2. assertEquals(String expected, String current)
  3. assertEquals(String message, Object expected, Object actual)
  4. assertEquals(T expected, T actual)
  5. assertEqualsAny(Object obj1, Object[] objects, String errMsg)