Class TransceiverTest
java.lang.Object
org.opentrafficsim.sim0mq.publisher.TransceiverTest
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
Modifier and TypeFieldDescription(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
-
Method Summary
Modifier and TypeMethodDescriptionObject[]
checkAckNack
(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.
-
Field Details
-
lastAckNack
Boolean lastAckNackStorage for the last ACK or NACK value submitted to the ReturnWrapper. -
lastPayload
Object[] lastPayloadStorage for the last payload submitted to the ReturnWrapper. -
lastContent
Serializable lastContentStorage for last content submitted to notify method in EventListener. -
lastTime
org.djunits.value.vdouble.scalar.Time lastTimeTime 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.GtuExceptionTest the GtuIdTransceiver and the GtuTransceiver.- Throws:
RemoteException
- if the happens, this test has failedorg.djutils.serialization.SerializationException
- on errororg.sim0mq.Sim0MQException
- on errororg.opentrafficsim.core.network.NetworkException
- on errororg.opentrafficsim.core.geometry.OtsGeometryException
- on errorNamingException
- on errornl.tudelft.simulation.dsol.SimRuntimeException
- on errororg.opentrafficsim.core.gtu.GtuException
- on error
-
checkAckNack
public Object[] checkAckNack(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 testaddress
- Object[]; the argument of the get method of the transceiverexpectedAckNack
- Boolean; null if neither an ACK nor a NACK is expected, Boolean.FALSE if a NACK is expected, Boolean.TRUE if an ACK is expectedexpectedInPayload
- 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 failedorg.sim0mq.Sim0MQException
- if that happens, this test has failedRemoteException
- 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.
-