예제 #1
0
 public final boolean assertInstanceOf(String $label, Class<?> $klass, Object $obj) {
   if ($obj == null) {
     $unitFailures++;
     $log.warn(
         messageFail(
             $label, "null is never an instance of anything, and certainly not " + $klass + "."),
         new AssertionFailed());
     return false;
   }
   try {
     $klass.cast($obj);
     $log.debug(
         messagePass(
             $label,
             "\""
                 + $obj.getClass().getCanonicalName()
                 + "\" is an instance of \""
                 + $klass.getCanonicalName()
                 + "\""));
     return true;
   } catch (ClassCastException $e) {
     $unitFailures++;
     $log.warn(messageFail($label, $e.getMessage() + "."), new AssertionFailed());
     return false;
   }
 }
 private String pathOf(Class<?> api) {
   return api.getCanonicalName().replace('.', '/');
 }