Package org.dellroad.stuff.test
Class TestSupport
java.lang.Object
org.dellroad.stuff.test.TestSupport
Base class for unit tests providing logging and random seed setup.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertSameOrDiff(String expected, String actual) protected <T> Set<jakarta.validation.ConstraintViolation<T>>checkValid(T object, boolean valid) protected StringRundiff(1)on two strings.static Randomjakarta.validation.Validatorprotected StringreadResource(File file) Read some file in as a UTF-8 encoded string.protected StringreadResource(String path) Read some classpath resource in as a UTF-8 encoded string.protected StringreadResource(URL url) Read some URL resource in as a UTF-8 encoded string.voidseedRandom(String randomSeed)
-
Field Details
-
log
-
random
-
-
Constructor Details
-
TestSupport
public TestSupport()
-
-
Method Details
-
getValidator
public jakarta.validation.Validator getValidator() -
seedRandom
-
getRandom
-
checkValid
-
readResource
Read some file in as a UTF-8 encoded string.- Parameters:
file- file to read from- Returns:
- contents of file
-
readResource
Read some classpath resource in as a UTF-8 encoded string.- Parameters:
path- classpath resource to read from- Returns:
- contents of resource
-
readResource
Read some URL resource in as a UTF-8 encoded string.- Parameters:
url- resource to read from- Returns:
- contents of resource
-
assertSameOrDiff
-
diff
Rundiff(1)on two strings.- Parameters:
s1- first strings2- second string- Returns:
- the diff, or null if strings are the same
-