public class Classes
extends java.lang.Object
Class
s.Modifier and Type | Field and Description |
---|---|
(package private) Failures |
failures |
private static Classes |
INSTANCE |
Constructor and Description |
---|
Classes() |
Modifier and Type | Method and Description |
---|---|
void |
assertContainsAnnotations(AssertionInfo info,
java.lang.Class<?> actual,
java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)
Verifies that the actual
Class contains the given Annotation s. |
void |
assertHasDeclaredFields(AssertionInfo info,
java.lang.Class<?> actual,
java.lang.String... fields)
Verifies that the actual
Class has the declared fields . |
void |
assertHasFields(AssertionInfo info,
java.lang.Class<?> actual,
java.lang.String... fields)
Verifies that the actual
Class has the fields . |
void |
assertIsAnnotation(AssertionInfo info,
java.lang.Class<?> actual)
Verifies that the actual
Class is an annotation. |
void |
assertIsAssignableFrom(AssertionInfo info,
java.lang.Class<?> actual,
java.lang.Class<?>... others)
Verifies that the actual
Class is assignable from all the others classes. |
void |
assertIsFinal(AssertionInfo info,
java.lang.Class<?> actual)
Verifies that the actual
Class is final. |
void |
assertIsInterface(AssertionInfo info,
java.lang.Class<?> actual)
Verifies that the actual
Class is an interface. |
void |
assertIsNotAnnotation(AssertionInfo info,
java.lang.Class<?> actual)
Verifies that the actual
Class is not an annotation. |
void |
assertIsNotFinal(AssertionInfo info,
java.lang.Class<?> actual)
Verifies that the actual
Class is not final. |
void |
assertIsNotInterface(AssertionInfo info,
java.lang.Class<?> actual)
Verifies that the actual
Class is not an interface. |
private static void |
assertNotNull(AssertionInfo info,
java.lang.Class<?> actual) |
private static void |
classParameterIsNotNull(java.lang.Class<?> clazz)
used to check that the class to compare is not null, in that case throws a
NullPointerException with an
explicit message. |
private static java.util.Set<java.lang.String> |
fieldsToName(java.lang.reflect.Field[] fields) |
static Classes |
instance()
Returns the singleton instance of this class.
|
private static boolean |
noMissingFields(java.util.Set<java.lang.String> actualFieldNames,
java.util.Set<java.lang.String> expectedFieldNames,
java.util.Set<java.lang.String> missingFieldNames) |
public static Classes instance()
public void assertIsAssignableFrom(AssertionInfo info, java.lang.Class<?> actual, java.lang.Class<?>... others)
Class
is assignable from all the others
classes.info
- contains information about the assertion.actual
- the "actual" Class
.others
- the others Class
who this actual class must be assignable.java.lang.NullPointerException
- if one of the others
is null
.java.lang.AssertionError
- if actual
is null
.java.lang.AssertionError
- if the actual Class
is not assignable from all of the others
classes.public void assertIsNotInterface(AssertionInfo info, java.lang.Class<?> actual)
Class
is not an interface.info
- contains information about the assertion.actual
- the "actual" Class
.java.lang.AssertionError
- if actual
is null
.java.lang.AssertionError
- if the actual Class
is an interface.public void assertIsInterface(AssertionInfo info, java.lang.Class<?> actual)
Class
is an interface.info
- contains information about the assertion.actual
- the "actual" Class
.java.lang.AssertionError
- if actual
is null
.java.lang.AssertionError
- if the actual Class
is not an interface.public void assertIsNotAnnotation(AssertionInfo info, java.lang.Class<?> actual)
Class
is not an annotation.info
- contains information about the assertion.actual
- the "actual" Class
.java.lang.AssertionError
- if actual
is null
.java.lang.AssertionError
- if the actual Class
is an annotation.public void assertIsAnnotation(AssertionInfo info, java.lang.Class<?> actual)
Class
is an annotation.info
- contains information about the assertion.actual
- the "actual" Class
.java.lang.AssertionError
- if actual
is null
.java.lang.AssertionError
- if the actual Class
is not an annotation.public void assertIsFinal(AssertionInfo info, java.lang.Class<?> actual)
Class
is final.info
- contains information about the assertion.actual
- the "actual" Class
.java.lang.AssertionError
- if actual
is null
.java.lang.AssertionError
- if the actual Class
is not final.public void assertIsNotFinal(AssertionInfo info, java.lang.Class<?> actual)
Class
is not final.info
- contains information about the assertion.actual
- the "actual" Class
.java.lang.AssertionError
- if actual
is null
.java.lang.AssertionError
- if the actual Class
is final.public void assertContainsAnnotations(AssertionInfo info, java.lang.Class<?> actual, java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)
Class
contains the given Annotation
s.info
- contains information about the assertion.actual
- the "actual" Class
.annotations
- annotations who must be attached to the classjava.lang.AssertionError
- if actual
is null
.java.lang.AssertionError
- if the actual Class
doesn't contains all of these annotations.public void assertHasFields(AssertionInfo info, java.lang.Class<?> actual, java.lang.String... fields)
Class
has the fields
.info
- contains information about the assertion.actual
- the "actual" Class
.fields
- the fields who must be present in the class.java.lang.AssertionError
- if actual
is null
.java.lang.AssertionError
- if the actual Class
doesn't contains all of the field.private static boolean noMissingFields(java.util.Set<java.lang.String> actualFieldNames, java.util.Set<java.lang.String> expectedFieldNames, java.util.Set<java.lang.String> missingFieldNames)
public void assertHasDeclaredFields(AssertionInfo info, java.lang.Class<?> actual, java.lang.String... fields)
Class
has the declared fields
.info
- contains information about the assertion.actual
- the "actual" Class
.fields
- the fields who must be declared in the class.java.lang.AssertionError
- if actual
is null
.java.lang.AssertionError
- if the actual Class
doesn't contains all of the field.private static java.util.Set<java.lang.String> fieldsToName(java.lang.reflect.Field[] fields)
private static void assertNotNull(AssertionInfo info, java.lang.Class<?> actual)
private static void classParameterIsNotNull(java.lang.Class<?> clazz)
NullPointerException
with an
explicit message.clazz
- the date to checkjava.lang.NullPointerException
- with an explicit message if the given class is null