public class ClassAssert extends AbstractClassAssert<ClassAssert>
Class
es.
To create a new instance of this class, invoke Assertions.assertThat(Class)
actual, info, myself
Modifier | Constructor and Description |
---|---|
protected |
ClassAssert(Class<?> actual) |
Modifier and Type | Method and Description |
---|---|
ClassAssert |
hasAnnotations(Class<? extends Annotation>... annotations)
Verifies that the actual
Class has the given Annotation s. |
hasAnnotation, hasDeclaredFields, hasFields, isAnnotation, isAssignableFrom, isInterface, isNotAnnotation, isNotInterface
as, as, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, inBinary, inHexadecimal, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, overridingErrorMessage, usingComparator, usingDefaultComparator, withThreadDumpOnError
protected ClassAssert(Class<?> actual)
@SafeVarargs public final ClassAssert hasAnnotations(Class<? extends Annotation>... annotations)
AbstractClassAssert
Class
has the given Annotation
s.
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
private static @interface Force { }
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
private static @interface Hero { }
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
private static @interface DarkSide { }
@Hero @Force
class Jedi implements Jedi {}
// Should pass:
assertThat(Jedi.class).containsAnnotations(Force.class, Hero.class);
// Should fail:
assertThat(Jedi.class).containsAnnotations(Force.class, DarkSide.class);
hasAnnotations
in class AbstractClassAssert<ClassAssert>
annotations
- annotations who must be attached to the classCopyright © 2013-2015 AssertJ. All Rights Reserved.