Class Tests

java.lang.Object
org.djutils.serialization.Tests

public class Tests extends Object
Test message conversions.

Copyright (c) 2019-2024 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 Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static class 
    Class used to test serialization of classes that implement SerializableObject.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static boolean
    Compare two arrays of any type (stolen from java.util.Arrays).
    (package private) static Object
    Convert an array, or matrix of Byte, Short, Integer, etc. to an array/matrix of byte, short, int, etc.
    void
    Test the Pointer class.
    final void
    Test all constructors for SerializationException.
    final void
    Test all constructors for SerializationRuntimeException.
    void
    Basic test encoding and decoding of the basic types.
    void
    Test serialization and deserialization of arrays of Djutils vectors.
    void
    Test encoding and decoding of arrays.
    void
    Test the toString and dataClassName methods of the BasicSerializer.
    void
    Test the compound array encoder and decoder.
    void
    Test stored information about djunits display types.
    void
    Test encoding and decoding of strongly typed quantities (DJUNITS).
    void
    Test the remainder of the EndianUtil class.
    void
    Test that jagged matrices are detected and cause a SerializationException.
    void
    Test encoding and decoding of arrays.
    void
    Test stored information about djunits SerializationUnits.
    void
    Test encoding and decoding of Strings with more exotic characters for UTF-8 and UTF-16.
    void
    Test that the encoder throws a SerializationException when given something that it does not know how to serialize.
    void
    Test the UnitType class.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Tests

      public Tests()
  • Method Details

    • simpleTests

      @Test public void simpleTests() throws SerializationException
      Basic test encoding and decoding of the basic types.
      Throws:
      SerializationException - when that happens uncaught this test has failed
    • testStrings

      @Test public void testStrings() throws SerializationException, UnsupportedEncodingException
      Test 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
    • testArrays

      @Test public void testArrays() throws SerializationException
      Test encoding and decoding of arrays.
      Throws:
      SerializationException - when that happens uncaught this test has failed
    • testMatrices

      @Test public void testMatrices() throws SerializationException
      Test encoding and decoding of arrays.
      Throws:
      SerializationException - when that happens uncaught this test has failed
    • testDJunits

      @Test public void testDJunits() throws SerializationException, org.djunits.value.ValueRuntimeException
      Test 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
    • testSerializationUnits

      @Test public void testSerializationUnits() throws SerializationException, org.djunits.value.ValueRuntimeException
      Test 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
    • testDJunitDisplayTypes

      @Test public void testDJunitDisplayTypes() throws SerializationException, org.djunits.value.ValueRuntimeException
      Test 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
    • testCompoundArrays

      @Test public void testCompoundArrays() throws SerializationException
      Test the compound array encoder and decoder.
      Throws:
      SerializationException - when that happens uncaught, this test has failed
    • testArrayOfDjutilsVectors

      @Test public void testArrayOfDjutilsVectors() throws org.djunits.value.ValueRuntimeException, SerializationException
      Test 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
    • testJaggedMatrices

      @Test public void testJaggedMatrices()
      Test that jagged matrices are detected and cause a SerializationException.
    • testUnhandledObject

      @Test public void testUnhandledObject()
      Test that the encoder throws a SerializationException when given something that it does not know how to serialize.
    • pointerTest

      @Test public void pointerTest()
      Test the Pointer class.
    • makePrimitive

      static 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.
    • deepEquals0

      static 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
    • testUnitType

      @Test public void testUnitType()
      Test the UnitType class.
    • serializationExceptionTest

      @Test public final void serializationExceptionTest()
      Test all constructors for SerializationException.
    • serializationRuntimeExceptionTest

      @Test public final void serializationRuntimeExceptionTest()
      Test all constructors for SerializationRuntimeException.
    • testEndianUtil

      @Test public void testEndianUtil()
      Test the remainder of the EndianUtil class.
    • testBasicSerializer

      @Test public void testBasicSerializer()
      Test the toString and dataClassName methods of the BasicSerializer.