Java Assert assertMessageEquals(Throwable ex, String msg)

Here you can find the source of assertMessageEquals(Throwable ex, String msg)

Description

assert Message Equals

License

Open Source License

Declaration

static void assertMessageEquals(Throwable ex, String msg) throws AssertionError 

Method Source Code

//package com.java2s;
/*//  w w w  .ja v  a2  s.  c o m
 * Copyright 2015-2017 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v2.0 which
 * accompanies this distribution and is available at
 *
 * http://www.eclipse.org/legal/epl-v20.html
 */

public class Main {
    static void assertMessageEquals(Throwable ex, String msg) throws AssertionError {
        if (!msg.equals(ex.getMessage())) {
            throw new AssertionError(
                    "Exception message should be [" + msg + "], but was [" + ex.getMessage() + "].");
        }
    }
}

Related

  1. assertLegal(Object underAssertion, String message)
  2. assertLongPositive(long val, String name)
  3. assertMandatoryParameter(boolean assertion, String parameterName)
  4. assertMatches(String name, String regExp, String actual)
  5. assertMergeTestPostcondition(double[] arr, long[] brr, int arrLen)
  6. assertNonEmpty(String s, String name)
  7. assertNonFatal(boolean test, String msg)
  8. assertNonNegative(int field, String fieldName)
  9. assertNonZero(int i, String fieldName)