@Singleton public class TestUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
SYS_PROPERTY_OUTPUT_DIR
Name of the system property to override the default output directory
|
static String |
SYS_PROPERTY_PROFILE
Name of the system property to pass the desired profile
|
static String |
SYS_PROPERTY_REPORT_FILE
Name of the system property to override the default report file
|
static String |
SYS_PROPERTY_VERBOSE
Name of the system property to set the
verbose flag |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertValue(String section,
Object value,
String methodName,
Object instance)
Checks the returned value, when calling a given method.
|
static void |
testComparable(String section,
Class<?> type)
Tests if the given type is comparable.
|
static void |
testHasNotPublicMethod(String section,
Class type,
Class returnType,
String name,
Class... paramTypes)
Tests if the given type has not a public method with the given signature.
|
static void |
testHasPublicMethod(String section,
Class<?> type,
boolean trySuperclassFirst,
Class<?> returnType,
String name,
Class<?>... paramTypes)
Deprecated.
use the simplified version on top of Reflections.org where possible
|
static void |
testHasPublicMethod(String section,
Class<?> type,
Class<?> returnType,
String name,
Class... paramTypes)
Deprecated.
use the simplified version on top of Reflections.org where possible
|
static void |
testHasPublicMethod(String section,
Class<?> type,
String name)
Deprecated.
use the simplified version on top of Reflections.org where possible
|
static void |
testHasPublicMethod(String section,
Class<?> type,
String name,
boolean hasParameters)
Tests if the given type has a public method with the given signature.
|
static void |
testImmutable(String section,
Class<?> type)
Tests the given class being serializable.
|
static boolean |
testImmutableOpt(String section,
Class type)
Test for immutability (optional recommendation), writes a warning if not given.
|
static void |
testImplementsInterface(String section,
Class<?> type,
Class<?> iface)
Tests the given class implements a given interface.
|
static void |
testSerializable(String section,
Class<?> type)
Tests the given object being (effectively) serializable by serializing it.
|
static void |
testSerializable(String section,
Object o)
Tests the given object being (effectively) serializable by serializing it.
|
static boolean |
testSerializableOpt(String section,
Class type)
Test for serializable (optional recommendation), writes a warning if not given.
|
static boolean |
testSerializableOpt(String section,
Object instance)
Test for serializable (optional recommendation), writes a warning if not given.
|
public static final String SYS_PROPERTY_PROFILE
public static final String SYS_PROPERTY_OUTPUT_DIR
public static final String SYS_PROPERTY_REPORT_FILE
public static final String SYS_PROPERTY_VERBOSE
verbose flagpublic static void testSerializable(String section, Class<?> type)
section - the section of the spec under testtype - the type to be checked.TCKValidationException - if the test fails.public static void testImmutable(String section, Class<?> type)
section - the section of the spec under testtype - the type to be checked.TCKValidationException - if test fails.public static void testSerializable(String section, Object o)
section - the section of the spec under testo - the object to be checked.TCKValidationException - if test fails.public static void testImplementsInterface(String section, Class<?> type, Class<?> iface)
section - the section of the spec under testtype - the type to be checked.iface - the interface to be checked for.Assert#fail - if test fails.public static void testComparable(String section, Class<?> type)
section - the section of the spec under testtype - the type to be checked.public static void testHasPublicMethod(String section, Class<?> type, Class<?> returnType, String name, Class... paramTypes)
section - type - returnType - name - paramTypes - public static void testHasPublicMethod(String section, Class<?> type, boolean trySuperclassFirst, Class<?> returnType, String name, Class<?>... paramTypes)
section - type - trySuperclassFirst - returnType - name - paramTypes - public static void testHasPublicMethod(String section, Class<?> type, String name, boolean hasParameters)
section - the section of the spec under testtype - the type to be checked.name - the method namehasParameters - the method has parameters.TCKValidationException - if test fails.public static void testHasPublicMethod(String section, Class<?> type, String name)
section - type - name - public static void testHasNotPublicMethod(String section, Class type, Class returnType, String name, Class... paramTypes)
section - the section of the spec under testtype - the type to be checked.returnType - the method return type.name - the method nameparamTypes - the parameter types.TCKValidationException - if test fails.public static void assertValue(String section, Object value, String methodName, Object instance) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
section - the section of the spec under testvalue - the expected valuemethodName - the target method nameinstance - the instance to callNoSuchMethodExceptionSecurityExceptionIllegalAccessExceptionIllegalArgumentExceptionInvocationTargetExceptionTCKValidationException - if test fails.public static boolean testImmutableOpt(String section, Class type)
section - the section of the spec under testtype - the type to be checked.public static boolean testSerializableOpt(String section, Class type)
section - the section of the spec under testtype - the type to be checked.public static boolean testSerializableOpt(String section, Object instance)
section - the section of the spec under testinstance - the object to be checked.Copyright © 2005–2018 Units of Measurement project. All rights reserved.