Package org.assertj.core.api
Class ClassAssert
- All Implemented Interfaces:
Assert<ClassAssert,
,Class<?>> Descriptable<ClassAssert>
,ExtensionPoints<ClassAssert,
Class<?>>
Assertion methods for
Class
es.
To create a new instance of this class, invoke Assertions.assertThat(Class)
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractClassAssert
classes
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, conditions, info, myself, objects
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ClassAssert
hasAnnotations
(Class<? extends Annotation>... annotations) Verifies that the actualClass
has the givenAnnotation
s.Methods inherited from class org.assertj.core.api.AbstractClassAssert
hasAnnotation, hasDeclaredFields, hasDeclaredMethods, hasFields, hasMethods, hasOnlyDeclaredFields, hasOnlyPublicFields, hasPublicFields, hasPublicMethods, isAnnotation, isAssignableFrom, isFinal, isInterface, isNotAnnotation, isNotFinal, isNotInterface, isProtected, isPublic
Methods inherited from class org.assertj.core.api.AbstractAssert
as, as, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasToString, inBinary, inHexadecimal, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, overridingErrorMessage, satisfies, setCustomRepresentation, throwAssertionError, usingComparator, usingDefaultComparator, withFailMessage, withRepresentation, withThreadDumpOnError
-
Constructor Details
-
ClassAssert
-
-
Method Details
-
hasAnnotations
Description copied from class:AbstractClassAssert
Verifies that the actualClass
has the givenAnnotation
s.Example:
@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 {} // this assertion succeeds: assertThat(Jedi.class).containsAnnotations(Force.class, Hero.class); // this assertion fails: assertThat(Jedi.class).containsAnnotations(Force.class, DarkSide.class);
- Overrides:
hasAnnotations
in classAbstractClassAssert<ClassAssert>
- Parameters:
annotations
- annotations who must be attached to the class
-