public class ClassAsserts extends Object
Constructor and Description |
---|
ClassAsserts() |
Modifier and Type | Method and Description |
---|---|
static void |
assertEqualsValid(Object o1,
Object o2,
List excludedFields)
Tests that a class' equals method notice changed fields.
|
static void |
assertHasFactoryMethod(Class c)
Tests the class has a static factory method getInstance()
|
static <T> void |
assertPrivateConstructor(Class<T> c)
Tests if there are any public constructors.
|
static <T> T |
assertSingleton(Class<T> c)
Tests that a class has a static factory method getInstance() and that it acts as a singleton.
|
public ClassAsserts()
public static void assertHasFactoryMethod(Class c)
c
- the class to testpublic static <T> T assertSingleton(Class<T> c)
c
- the class to testpublic static <T> void assertPrivateConstructor(Class<T> c)
c
- A class to test.public static void assertEqualsValid(Object o1, Object o2, List excludedFields) throws IllegalAccessException
o1
- An object to test on.o2
- Another object with all fields to be tested set to different values from o1excludedFields
- A list of field names of fields that should not be included in the test.IllegalAccessException
Copyright © 2005–2015 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.