|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.qualitytest.StaticCheck
public final class StaticCheck
This class offers simple static methods to test static properties of your classes. These checks are typically only called from within unit tests, because they are costly. Static tests in unit tests ensure that certain intended properties of a class (e.g. immutability, thread-safeness, no non static finals, etc.) are still true after future changes.
Method Summary | |
---|---|
static Class<?> |
classIsFinal(Class<?> clazz)
Check if a class is final. |
static Class<?> |
noNonFinalStatic(Class<?> clazz)
Check if a class contains a non-final static variable. |
static Class<?> |
noNonFinalStaticInHierarchy(Class<?> clazz)
Check if a class or super-class contains a non-final static variable. |
static Class<?> |
noPublicDefaultConstructor(Class<?> clazz)
Check that a class contains no public default constructor. |
static Class<?> |
publicMethodsAnnotated(Class<?> clazz,
Class<? extends Annotation> annotation)
Check that all declared public methods of a class are annotated using a certain annotation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Class<?> classIsFinal(@Nonnull Class<?> clazz)
clazz
- A class that must be final.
IllegalNonFinalClassException
- If the passed class is not final.public static Class<?> noNonFinalStatic(@Nonnull Class<?> clazz)
clazz
- A class which is checked for non-final statics.
IllegalNonFinalStaticException
- If the passed class contains and non-final static field.public static Class<?> noNonFinalStaticInHierarchy(@Nonnull Class<?> clazz)
clazz
- A class which is checked for non-final statics.
IllegalNonFinalStaticException
- If the passed class contains and non-final static field.public static Class<?> noPublicDefaultConstructor(@Nonnull Class<?> clazz)
clazz
- A class which is checked for not having a public default constructor
IllegalClassWithPublicDefaultConstructorException
- If the passed class contains a public default constructor.public static Class<?> publicMethodsAnnotated(@Nonnull Class<?> clazz, @Nonnull Class<? extends Annotation> annotation)
clazz
- A class that must have annotations on all public methods.annotation
- An annotation that must be present on all public methods in a class
IllegalMissingAnnotationOnMethodException
- if the one or more public methods of a Class
are not annotated with a specific
Annotation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |