Package org.djutils.serialization
Class Tests
- java.lang.Object
- 
- org.djutils.serialization.Tests
 
- 
 public class Tests extends Object Test message conversions.Copyright (c) 2019-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. 
 BSD-style license. See OpenTrafficSim License.- Author:
- Alexander Verbraeck, Peter Knoppers
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description (package private) static classTests.CompoundClass used to test serialization of classes that implement SerializableObject.
 - 
Constructor SummaryConstructors Constructor Description Tests()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static booleandeepEquals0(Object e1, Object e2)Compare two arrays of any type (stolen from java.util.Arrays).(package private) static ObjectmakePrimitive(Object in)Convert an array, or matrix of Byte, Short, Integer, etc.voidpointerTest()Test the Pointer class.voidserializationExceptionTest()Test all constructors for SerializationException.voidserializationRuntimeExceptionTest()Test all constructors for SerializationRuntimeException.voidsimpleTests()Basic test encoding and decoding of the basic types.voidtestArrayOfDjutilsVectors()Test serialization and deserialization of arrays of Djutils vectors.voidtestArrays()Test encoding and decoding of arrays.voidtestBasicSerializer()Test the toString and dataClassName methods of the BasicSerializer.voidtestCompoundArrays()Test the compound array encoder and decoder.voidtestDJunitDisplayTypes()Test stored information about djunits display types.voidtestDJunits()Test encoding and decoding of strongly typed quantities (DJUNITS).voidtestEndianUtil()Test the remainder of the EndianUtil class.voidtestJaggedMatrices()Test that jagged matrices are detected and cause a SerializationException.voidtestMatrices()Test encoding and decoding of arrays.voidtestSerializationUnits()Test stored information about djunits SerializationUnits.voidtestStrings()Test encoding and decoding of Strings with more exotic characters for UTF-8 and UTF-16.voidtestUnhandledObject()Test that the encoder throws a SerializationException when given something that it does not know how to serialize.voidtestUnitType()Test the UnitType class.
 
- 
- 
- 
Method Detail- 
simpleTestspublic void simpleTests() throws SerializationExceptionBasic test encoding and decoding of the basic types.- Throws:
- SerializationException- when that happens uncaught this test has failed
 
 - 
testStringspublic void testStrings() throws SerializationException, UnsupportedEncodingExceptionTest encoding and decoding of Strings with more exotic characters for UTF-8 and UTF-16.- Throws:
- SerializationException- when that happens uncaught this test has failed
- UnsupportedEncodingException- when UTF-8 en/decoding fails
 
 - 
testArrayspublic void testArrays() throws SerializationExceptionTest encoding and decoding of arrays.- Throws:
- SerializationException- when that happens uncaught this test has failed
 
 - 
testMatricespublic void testMatrices() throws SerializationExceptionTest encoding and decoding of arrays.- Throws:
- SerializationException- when that happens uncaught this test has failed
 
 - 
testDJunitspublic void testDJunits() throws SerializationException, org.djunits.value.ValueRuntimeExceptionTest encoding and decoding of strongly typed quantities (DJUNITS).- Throws:
- SerializationException- when that happens uncaught, this test has failed
- org.djunits.value.ValueRuntimeException- when that happens uncaught, this test has failed
 
 - 
testSerializationUnitspublic void testSerializationUnits() throws SerializationException, org.djunits.value.ValueRuntimeExceptionTest stored information about djunits SerializationUnits.- Throws:
- SerializationException- when that happens uncaught, this test has failed
- org.djunits.value.ValueRuntimeException- when that happens uncaught, this test has failed
 
 - 
testDJunitDisplayTypespublic void testDJunitDisplayTypes() throws SerializationException, org.djunits.value.ValueRuntimeExceptionTest stored information about djunits display types.- Throws:
- SerializationException- when that happens uncaught, this test has failed
- org.djunits.value.ValueRuntimeException- when that happens uncaught, this test has failed
 
 - 
testCompoundArrayspublic void testCompoundArrays() throws SerializationExceptionTest the compound array encoder and decoder.- Throws:
- SerializationException- when that happens uncaught, this test has failed
 
 - 
testArrayOfDjutilsVectorspublic void testArrayOfDjutilsVectors() throws org.djunits.value.ValueRuntimeException, SerializationExceptionTest serialization and deserialization of arrays of Djutils vectors.- Throws:
- org.djunits.value.ValueRuntimeException- if that happens uncaught; this test has failed
- SerializationException- if that happens uncaught; this test has failed
 
 - 
testJaggedMatricespublic void testJaggedMatrices() Test that jagged matrices are detected and cause a SerializationException.
 - 
testUnhandledObjectpublic void testUnhandledObject() Test that the encoder throws a SerializationException when given something that it does not know how to serialize.
 - 
pointerTestpublic void pointerTest() Test the Pointer class.
 - 
makePrimitivestatic Object makePrimitive(Object in) Convert an array, or matrix of Byte, Short, Integer, etc. to an array/matrix of byte, short, int, etc.- Parameters:
- in- Object; the array to convert
- Returns:
- Object; the converted input (if conversion was possible), or the unconverted input.
 
 - 
deepEquals0static boolean deepEquals0(Object e1, Object e2) Compare two arrays of any type (stolen from java.util.Arrays).- Parameters:
- e1- Object (should be some kind of array)
- e2- Object (should be some kind of array)
- Returns:
- boolean; true of the arrays have the same type, size and all elements in the arrays are equal to their counterpart
 
 - 
testUnitTypepublic void testUnitType() Test the UnitType class.
 - 
serializationExceptionTestpublic final void serializationExceptionTest() Test all constructors for SerializationException.
 - 
serializationRuntimeExceptionTestpublic final void serializationRuntimeExceptionTest() Test all constructors for SerializationRuntimeException.
 - 
testEndianUtilpublic void testEndianUtil() Test the remainder of the EndianUtil class.
 - 
testBasicSerializerpublic void testBasicSerializer() Test the toString and dataClassName methods of the BasicSerializer.
 
- 
 
-