Java Assert Equal assertEquals(String expected, String current)

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

Description

This method is used in the static block to checks whether the field costCenter is available.

License

Open Source License

Parameter

Parameter Description
expected The expected value.
current The current value.

Declaration

private static void assertEquals(String expected, String current) 

Method Source Code

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

public class Main {
    /**//w  ww  .j a v  a2s .co m
     * This method is used in the static block to checks whether the field costCenter is available.
     * In order to be able to use this method in the static block this method has to be static, too.
     * 
     * @param expected The expected value.
     * @param current The current value.
     */
    private static void assertEquals(String expected, String current) {
        if (!expected.equals(current)) {
            throw new RuntimeException("Assertion failed. Expected: <"
                    + expected + "> but was: <" + current + ">");
        }
    }
}

Related

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