Package org.powertac.visualizer.web.rest
Class TestUtil
- java.lang.Object
-
- org.powertac.visualizer.web.rest.TestUtil
-
public class TestUtil extends Object
Utility class for testing REST controllers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TestUtil.ZonedDateTimeMatcher
A matcher that tests that the examined string represents the same instant as the reference datetime.
-
Field Summary
Fields Modifier and Type Field Description static org.springframework.http.MediaType
APPLICATION_JSON_UTF8
MediaType for JSON UTF8
-
Constructor Summary
Constructors Constructor Description TestUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
convertObjectToJsonBytes(Object object)
Convert an object to JSON byte array.static byte[]
createByteArray(int size, String data)
Create a byte array with a specific size filled with specified data.static void
equalsVerifier(Class clazz)
Verifies the equals/hashcode contract on the domain object.static TestUtil.ZonedDateTimeMatcher
sameInstant(ZonedDateTime date)
Creates a matcher that matches when the examined string reprensents the same instant as the reference datetime
-
-
-
Method Detail
-
convertObjectToJsonBytes
public static byte[] convertObjectToJsonBytes(Object object) throws IOException
Convert an object to JSON byte array.- Parameters:
object
- the object to convert- Returns:
- the JSON byte array
- Throws:
IOException
-
createByteArray
public static byte[] createByteArray(int size, String data)
Create a byte array with a specific size filled with specified data.- Parameters:
size
- the size of the byte arraydata
- the data to put in the byte array- Returns:
- the JSON byte array
-
sameInstant
public static TestUtil.ZonedDateTimeMatcher sameInstant(ZonedDateTime date)
Creates a matcher that matches when the examined string reprensents the same instant as the reference datetime- Parameters:
date
- the reference datetime against which the examined string is checked
-
-