Class TransceiverTest

java.lang.Object
org.opentrafficsim.sim0mq.publisher.TransceiverTest

public class TransceiverTest extends Object
Unit tests.

Copyright (c) 2020-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Peter Knoppers
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) Boolean
    Storage for the last ACK or NACK value submitted to the ReturnWrapper.
    (package private) Serializable
    Storage for last content submitted to notify method in EventListener.
    (package private) Object[]
    Storage for the last payload submitted to the ReturnWrapper.
    (package private) org.djunits.value.vdouble.scalar.Time
    Time stamp of last notify event.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    checkAckNack(org.opentrafficsim.sim0mq.publisher.TransceiverInterface transceiver, Object[] address, Boolean expectedAckNack, String expectedInPayload)
    Call the get method of a TransceiverInterface and verify most of the results.
    void
    Test the GtuIdTransceiver and the GtuTransceiver.
    void
    Test the constructResultFields method for a class that it cannot handle.
    void
    Test the static verifyMetaData method in AbstractTransceiver.

    Methods inherited from class java.lang.Object

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

    • lastAckNack

      Boolean lastAckNack
      Storage for the last ACK or NACK value submitted to the ReturnWrapper.
    • lastPayload

      Object[] lastPayload
      Storage for the last payload submitted to the ReturnWrapper.
    • lastContent

      Serializable lastContent
      Storage for last content submitted to notify method in EventListener.
    • lastTime

      org.djunits.value.vdouble.scalar.Time lastTime
      Time stamp of last notify event.
  • Constructor Details

    • TransceiverTest

      public TransceiverTest()
  • Method Details

    • testGtuIdTransceiver

      @Test public void testGtuIdTransceiver() throws RemoteException, org.sim0mq.Sim0MQException, org.djutils.serialization.SerializationException, org.opentrafficsim.core.network.NetworkException, org.opentrafficsim.core.geometry.OtsGeometryException, nl.tudelft.simulation.dsol.SimRuntimeException, NamingException, org.opentrafficsim.core.gtu.GtuException
      Test the GtuIdTransceiver and the GtuTransceiver.
      Throws:
      RemoteException - if the happens, this test has failed
      org.djutils.serialization.SerializationException - on error
      org.sim0mq.Sim0MQException - on error
      org.opentrafficsim.core.network.NetworkException - on error
      org.opentrafficsim.core.geometry.OtsGeometryException - on error
      NamingException - on error
      nl.tudelft.simulation.dsol.SimRuntimeException - on error
      org.opentrafficsim.core.gtu.GtuException - on error
    • checkAckNack

      public Object[] checkAckNack(org.opentrafficsim.sim0mq.publisher.TransceiverInterface transceiver, Object[] address, Boolean expectedAckNack, String expectedInPayload) throws RemoteException, org.sim0mq.Sim0MQException, org.djutils.serialization.SerializationException
      Call the get method of a TransceiverInterface and verify most of the results.
      Parameters:
      transceiver - TransceiverInterface; the transceiver to test
      address - Object[]; the argument of the get method of the transceiver
      expectedAckNack - Boolean; null if neither an ACK nor a NACK is expected, Boolean.FALSE if a NACK is expected, Boolean.TRUE if an ACK is expected
      expectedInPayload - String; text that should occur in the payload of the ACK or NACK, or null if no ACK or NACK is expected
      Returns:
      Object[]; the result of the get method should be null if an ACK or a NACK was received; non-null otherwise
      Throws:
      org.djutils.serialization.SerializationException - if that happens, this test has failed
      org.sim0mq.Sim0MQException - if that happens, this test has failed
      RemoteException - if that happens, this test has failed
    • testNoTransceiver

      @Test public void testNoTransceiver()
      Test the constructResultFields method for a class that it cannot handle.
    • testVerifyMetaData

      @Test public void testVerifyMetaData()
      Test the static verifyMetaData method in AbstractTransceiver.