Package org.assertj.reflection
Class ClassAssert
java.lang.Object
org.assertj.core.api.AbstractAssert<ClassAssert,Class<?>>
org.assertj.reflection.ClassAssert
- All Implemented Interfaces:
org.assertj.core.api.Assert<ClassAssert,
,Class<?>> org.assertj.core.api.Descriptable<ClassAssert>
,org.assertj.core.api.ExtensionPoints<ClassAssert,
Class<?>>
Assertions for the
Class
type.-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionhasDeclaredConstructor
(Class<?>... parameterTypes) Verifies that theClass
has a declared constructor with the given argument types.hasDeclaredConstructor
(Class<?>[] parameterTypes, java.util.function.Consumer<ConstructorAssert> constructorAssertConsumer) Verifies that theClass
has a declared constructor with multiple arguments.hasDeclaredConstructor
(Class<?> parameterType, java.util.function.Consumer<ConstructorAssert> constructorAssertConsumer) Verifies that theClass
has a declared constructor with a single argument.hasDeclaredConstructor
(java.util.function.Consumer<ConstructorAssert> constructorAssertConsumer) Verifies that theClass
has a declared constructor with no arguments.hasDeclaredField
(String fieldName) Verifies that theClass
has a declared field with the given name.hasDeclaredField
(String fieldName, java.util.function.Consumer<FieldAssert> fieldAssertConsumer) Verifies that theClass
has a declared field with the given name.hasDeclaredMethod
(String methodName, Class<?>... parameterTypes) Verifies that theClass
has a declared method with the given name and argument types.hasDeclaredMethod
(String methodName, Class<?>[] parameterTypes, java.util.function.Consumer<MethodAssert> methodAssertConsumer) Verifies that theClass
has a declared method with the given name and multiple arguments.hasDeclaredMethod
(String methodName, Class<?> parameterType, java.util.function.Consumer<MethodAssert> methodAssertConsumer) Verifies that theClass
has a declared method with the given name and a single argument.hasDeclaredMethod
(String methodName, java.util.function.Consumer<MethodAssert> methodAssertConsumer) Verifies that theClass
has a declared method with the given name and no arguments.hasNoDeclaredConstructor
(Class<?>... parameterTypes) Verifies that theClass
does not have a declared constructor with the given argument types.hasNoDeclaredField
(String fieldName) Verifies that theClass
does not have a declared field with the given name.hasNoDeclaredMethod
(String methodName, Class<?>... parameterTypes) Verifies that theClass
has a declared method with the given name and argument types.Methods 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, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnError
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.assertj.core.api.Descriptable
as, as, as, describedAs
-
Constructor Details
-
ClassAssert
Creates a newClassAssert
.- Parameters:
actual
- The actual value.
-
-
Method Details
-
hasDeclaredConstructor
Verifies that theClass
has a declared constructor with the given argument types.- Parameters:
parameterTypes
- The types of the constructor arguments.- Returns:
- this
ClassAssert
instance.
-
hasDeclaredConstructor
public ClassAssert hasDeclaredConstructor(java.util.function.Consumer<ConstructorAssert> constructorAssertConsumer) Verifies that theClass
has a declared constructor with no arguments.- Parameters:
constructorAssertConsumer
- Consumer that is invoked with an instance ofConstructorAssert
, to perform additional assertions on the matched constructor.- Returns:
- this
ClassAssert
instance.
-
hasDeclaredConstructor
public ClassAssert hasDeclaredConstructor(Class<?> parameterType, java.util.function.Consumer<ConstructorAssert> constructorAssertConsumer) Verifies that theClass
has a declared constructor with a single argument.- Parameters:
parameterType
- The type of the constructor argument.constructorAssertConsumer
- Consumer that is invoked with an instance ofConstructorAssert
, to perform additional assertions on the matched constructor.- Returns:
- this
ClassAssert
instance.
-
hasDeclaredConstructor
public ClassAssert hasDeclaredConstructor(Class<?>[] parameterTypes, java.util.function.Consumer<ConstructorAssert> constructorAssertConsumer) Verifies that theClass
has a declared constructor with multiple arguments.- Parameters:
parameterTypes
- The types of the constructor arguments.constructorAssertConsumer
- Consumer that is invoked with an instance ofConstructorAssert
, to perform additional assertions on the matched constructor.- Returns:
- this
ClassAssert
instance.
-
hasNoDeclaredConstructor
Verifies that theClass
does not have a declared constructor with the given argument types.- Parameters:
parameterTypes
- The types of the constructor arguments.- Returns:
- this
ClassAssert
instance.
-
hasDeclaredField
Verifies that theClass
has a declared field with the given name.- Parameters:
fieldName
- The name of the declared field.- Returns:
- this
ClassAssert
instance.
-
hasDeclaredField
public ClassAssert hasDeclaredField(String fieldName, java.util.function.Consumer<FieldAssert> fieldAssertConsumer) Verifies that theClass
has a declared field with the given name.- Parameters:
fieldName
- The name of the declared field.fieldAssertConsumer
- Consumer that is invoked with an instance ofFieldAssert
, to perform additional assertions on the matched field.- Returns:
- this
ClassAssert
instance.
-
hasNoDeclaredField
Verifies that theClass
does not have a declared field with the given name.- Parameters:
fieldName
- The name of the declared field.- Returns:
- this
ClassAssert
instance.
-
hasDeclaredMethod
Verifies that theClass
has a declared method with the given name and argument types.- Parameters:
methodName
- The name of the declared method.parameterTypes
- The types of the declared method arguments.- Returns:
- this
ClassAssert
instance.
-
hasDeclaredMethod
public ClassAssert hasDeclaredMethod(String methodName, java.util.function.Consumer<MethodAssert> methodAssertConsumer) Verifies that theClass
has a declared method with the given name and no arguments.- Parameters:
methodName
- The name of the declared method.methodAssertConsumer
- Consumer that is invoked with an instance ofMethodAssert
, to perform additional assertions on the matched method.- Returns:
- this
ClassAssert
instance.
-
hasDeclaredMethod
public ClassAssert hasDeclaredMethod(String methodName, Class<?> parameterType, java.util.function.Consumer<MethodAssert> methodAssertConsumer) Verifies that theClass
has a declared method with the given name and a single argument.- Parameters:
methodName
- The name of the declared method.parameterType
- The type of the declared method argument.methodAssertConsumer
- Consumer that is invoked with an instance ofMethodAssert
, to perform additional assertions on the matched method.- Returns:
- this
ClassAssert
instance.
-
hasDeclaredMethod
public ClassAssert hasDeclaredMethod(String methodName, Class<?>[] parameterTypes, java.util.function.Consumer<MethodAssert> methodAssertConsumer) Verifies that theClass
has a declared method with the given name and multiple arguments.- Parameters:
methodName
- The name of the declared method.parameterTypes
- The types of the declared method arguments.methodAssertConsumer
- Consumer that is invoked with an instance ofMethodAssert
, to perform additional assertions on the matched method.- Returns:
- this
ClassAssert
instance.
-
hasNoDeclaredMethod
Verifies that theClass
has a declared method with the given name and argument types.- Parameters:
methodName
- The name of the declared method.parameterTypes
- The types of the declared method arguments.- Returns:
- this
ClassAssert
instance.
-