Java Assert assertInstanceOf(Object object, Class expectClass)

Here you can find the source of assertInstanceOf(Object object, Class expectClass)

Description

assert Instance Of

License

Apache License

Declaration

public static void assertInstanceOf(Object object, Class<?> expectClass) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static void assertInstanceOf(Object object, Class<?> expectClass) {
        boolean b = expectClass.isInstance(object);
        if (b == false) {
            throw new AssertionError(String.format("The expect class is %s, but actually %s.",
                    expectClass.getName(), object.getClass().getName()));
        }/*from w  w w. j  a v  a2  s  .c  o m*/
    }
}

Related

  1. assertInputNotEmpty(final String input, final String message)
  2. assertInstance(final Object object, final Class c)
  3. assertInstance(Object object, Class c)
  4. assertInstanceOf(Object obj, Class classType)
  5. assertInstanceOf(Object obj, Class expClass)
  6. assertIntegerGreaterThanZero(long number, String name)
  7. assertIntegerNotNegative(String message, int num)
  8. assertion(boolean isTrue, String reason)
  9. assertion(boolean value)