Package org.djutils.serialization
Class AbstractSerializationTest
java.lang.Object
org.djutils.serialization.AbstractSerializationTest
- Direct Known Subclasses:
ArraySerializationTest
,MatrixSerializationTest
,SerializationTest
,StringSerializationTest
,UnitSerializationTest
AbstractSerializationTest contain a number of helper methods for different tests.
Copyright (c) 2023-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
- Author:
- Alexander Verbraeck
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
compare
(byte[] actual, byte[] expected) Compare two byte arrays.protected boolean
deepEquals0
(Object e1, Object e2) Compare two arrays of any type (stolen from java.util.Arrays).protected Object
makePrimitive
(Object in) Convert an array, or matrix of Byte, Short, Integer, etc. to an array/matrix of byte, short, int, etc.
-
Constructor Details
-
AbstractSerializationTest
public AbstractSerializationTest()
-
-
Method Details
-
compare
protected void compare(byte[] actual, byte[] expected) Compare two byte arrays.- Parameters:
actual
- the calculated byte arrayexpected
- the expected byte array
-
makePrimitive
Convert an array, or matrix of Byte, Short, Integer, etc. to an array/matrix of byte, short, int, etc.- Parameters:
in
- the array to convert- Returns:
- the converted input (if conversion was possible), or the unconverted input.
-
deepEquals0
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:
- true of the arrays have the same type, size and all elements in the arrays are equal to their counterpart
-