Package org.assertj.core.api
Class ClassAssert
- All Implemented Interfaces:
Assert<ClassAssert,,Class<?>> Descriptable<ClassAssert>,ExtensionPoints<ClassAssert,Class<?>>
Assertion methods for
Classes.
To create a new instance of this class, invoke Assertions.assertThat(Class)
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractClassAssert
classesFields inherited from class org.assertj.core.api.AbstractAssert
actual, assertionErrorCreator, conditions, info, myself, objects, throwUnsupportedExceptionOnEquals -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ClassAsserthasAnnotations(Class<? extends Annotation>... annotations) Verifies that the actualClasshas the givenAnnotations.Methods inherited from class org.assertj.core.api.AbstractClassAssert
hasAnnotation, hasDeclaredFields, hasDeclaredMethods, hasFields, hasMethods, hasNoSuperclass, hasOnlyDeclaredFields, hasOnlyPublicFields, hasPackage, hasPackage, hasPublicFields, hasPublicMethods, hasSuperclass, isAbstract, isAnnotation, isAssignableFrom, isFinal, isInterface, isNotAnnotation, isNotFinal, isNotInterface, isPackagePrivate, isProtected, isPublicMethods inherited from class org.assertj.core.api.AbstractAssert
asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingRecursiveComparison, usingRecursiveComparison, withAssertionState, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnErrorMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.assertj.core.api.Descriptable
as, as, as, describedAs
-
Constructor Details
-
ClassAssert
-
-
Method Details
-
hasAnnotations
Description copied from class:AbstractClassAssertVerifies that the actualClasshas the givenAnnotations.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:
hasAnnotationsin classAbstractClassAssert<ClassAssert>- Parameters:
annotations- annotations who must be attached to the class- Returns:
thisassertions object
-