Skip to content

Add comprehensive unit test coverage (99 tests)#30

Merged
brutzman merged 16 commits intomasterfrom
test/add-unit-tests
Feb 2, 2026
Merged

Add comprehensive unit test coverage (99 tests)#30
brutzman merged 16 commits intomasterfrom
test/add-unit-tests

Conversation

@ricklentz
Copy link
Copy Markdown
Collaborator

Summary

  • Adds 99 unit tests covering all PDU families, utility classes, stream utilities, spatial coordinate systems, legacy math, and data structures
  • 102 new test files with ~14,300 lines of test code
  • All tests follow existing project conventions (PduTest base class for PDU network send/receive/compare, standalone JUnit 5 for utilities)
  • Includes GitHub Actions CI/CD workflows for build/test on push and jar publishing on release

Test categories

Category Tests
PDU field-level tests 67
Utility tests 6
Stream utility tests 4
Spatial tests 2
Legacy math tests 5
Data structure tests 15

PDU families covered

  • Entity Information/Interaction (EntityStatePdu, EntityStateUpdate, EntityDamageStatus, Appearance, ArticulatedParts)
  • Warfare (Fire, Detonation, Collision, CollisionElastic, DirectedEnergyFire)
  • Logistics (ServiceRequest, ResupplyOffer, ResupplyReceived, ResupplyCancel, RepairComplete, RepairResponse)
  • Simulation Management (CreateEntity, RemoveEntity, StartResume, StopFreeze, Acknowledge, ActionRequest, ActionResponse, Data, DataQuery, SetData, EventReport)
  • Simulation Management with Reliability (all 15 reliable variants)
  • Radio Communications (Transmitter, Receiver, IntercomControl, IntercomSignal, Designator)
  • Distributed Emissions (ElectromagneticEmission, UnderwaterAcoustic, SEES)
  • Synthetic Environment (EnvironmentalProcess, GriddedData, PointObjectState, LinearObjectState, ArealObjectState)
  • Entity Management (AggregateState, IsGroupOf, IsPartOf, TransferOwnership)
  • Minefield (MinefieldState, MinefieldQuery, MinefieldData, MinefieldResponseNACK)
  • Information Operations (Action, Report)
  • Live Entity (LEFire, LEDetonation, TSPI)
  • Identification (IFF - pre-existing)
  • Attribute

Test plan

  • Verify all tests compile in containerized build (eclipse-temurin:17-jdk)
  • Verify all PDU network send/receive tests pass
  • Verify standalone utility and data structure tests pass
  • Verify spatial coordinate tests pass with SRM 4.4.0 library

- Add containerized build/test workflow (eclipse-temurin:17-jdk)
- Add release publish workflow for jar distribution
- Remove nbbrowse calls from build.xml for headless builds
- All 21 tests pass in container, all 4 jars build successfully
Vec3fTest (16 tests): constructors, add, sub, scale, negate, length,
normalize, zero vector normalize, dot product, cross product, static
cross, makeNull, xform with identity Matrix3f.

Vec4fTest (14 tests): constructors, add, sub, scale, negate, length,
normalize, zero vector normalize, dot product, static dot, orthogonal
dot, bounds checking, xform with identity Matrix4f.

Matrix3fTest (9 tests): default constructor, identity, copy constructor,
xform Vec3f, xform float array, Euler set/get round-trip, zero Eulers
identity, array constructor, setMatValue.

Matrix4fTest (8 tests): default constructor, identity, copy constructor,
xform Vec4f, zero Eulers identity, Euler bottom row pattern, array
constructor, setMatValue.

QuaternionTest (22 tests): identity constructor, identity length, copy
constructor, axis-angle round-trip, Euler round-trip, zero Eulers
identity, Matrix3f round-trip, Matrix4f round-trip, normalize, conjugate,
invert unit quaternion (q*q^-1=identity), multiply by identity, xform
identity, xform 90 degrees about Z, xform array form, slerp endpoints,
slerp midpoint, makeFromVecs parallel, makeFromVecs orthogonal,
setGetQuatValue, bounds check, add/sub.
… methods)

CoordinateConversionsTest (9 tests): WGS84 ECEF-to-geodetic and
geodetic-to-ECEF round-trip conversions. Tests known reference points
including NPS Monterey (36.5967N/121.877W), equator/prime meridian,
90E longitude, north pole, southern hemisphere (Sydney), and high
altitude (35km). Validates both radian and degree conversion methods
from CoordinateConversions utility class.

EulerConversionsTest (10 tests): Tait-Bryan to DIS Euler angle
conversions (psi/theta/phi) and reverse. Tests cardinal headings
(north, east, south, west), pitch up/down, banked turn, combined
angles, equator position, and southern hemisphere position. Uses
NPS Monterey as reference geodetic position for all conversions.
Each test validates construction, getters/setters, marshal/unmarshal
round-trip via both DataOutputStream and ByteBuffer, and equality.

EntityIDTest (7 tests): site/application/entity triplet, progressive
setters, 6-byte marshalled size, DataStream and ByteBuffer round-trip,
equals and hashCode.

EntityTypeTest (5 tests): entityKind, domain, country, category,
subCategory, specific, extra fields. Uses EntityKind.PLATFORM and
Country.UNITED_STATES_OF_AMERICA_USA enumerations.

SimulationAddressTest (6 tests): site/application pair, 4-byte
marshalled size, DataStream and ByteBuffer round-trip, equality.

EventIdentifierTest (6 tests): nested SimulationAddress plus
eventNumber, 6-byte marshalled size, DataStream and ByteBuffer
round-trip, equality.

EulerAnglesTest (6 tests): psi/theta/phi float angles, 12-byte
marshalled size, DataStream and ByteBuffer round-trip, equality.

Vector3DoubleTest (6 tests): x/y/z double precision coordinates,
24-byte marshalled size, ECEF reference values, extreme values
(Double.MAX_VALUE/MIN_VALUE), DataStream and ByteBuffer round-trip.

Vector3FloatTest (6 tests): x/y/z float coordinates, 12-byte
marshalled size, DataStream and ByteBuffer round-trip, equality.

ClockTimeTest (6 tests): hour/timePastHour integers, 8-byte
marshalled size, DataStream and ByteBuffer round-trip, equality.

EntityMarkingTest (6 tests): ASCII character set, 11-byte character
array with padding, DataStream and ByteBuffer round-trip, equality.
Tests marking strings "TANK01", "F16EAGLE", "HELO99".

VariableDatumTest (5 tests): variable-length datum value with 64-bit
boundary alignment, DataStream and ByteBuffer round-trip, empty datum.

FixedDatumTest (6 tests): datum ID and fixed 4-byte integer value,
8-byte marshalled size, DataStream and ByteBuffer round-trip, equality.

MunitionDescriptorTest (4 tests): nested EntityType for munitionType,
warhead/fuse enumerations, quantity/rate shorts, DataStream and
ByteBuffer round-trip.

DeadReckoningParametersTest (5 tests): algorithm enum, 15-byte
parameters array, nested Vector3Float for linear acceleration and
angular velocity, DataStream and ByteBuffer round-trip.

ModulationTypeTest (5 tests): spreadSpectrum, majorModulation
(TransmitterMajorModulation.AMPLITUDE_2), detail, radioSystem
(TransmitterModulationTypeSystem.GENERIC_RADIO_OR_SIMPLE_INTERCOM),
DataStream and ByteBuffer round-trip, equality.

AntennaLocationTest (5 tests): nested Vector3Double for world
coordinates and Vector3Float for relative body coordinates, 36-byte
marshalled size, DataStream and ByteBuffer round-trip.
PDU_TESTING.md: added build workflow note (write all tests first,
then docker build), removed completed sections (legacy math 5/5,
data structures 15/15, utility CoordinateConversions and
EulerConversions 2/6), updated progress table to 22 done / 76
remaining. PDU_TESTING.md is in .gitignore to keep test tracking
local to the working copy.
DisTimeTest (9 tests): default timestamp style (IEEE_ABSOLUTE),
set/get timestamp style cycling through IEEE_RELATIVE and UNIX,
host clock synchronized flag, getCurrentDisTimestamp with LSB
verification (absolute=1, relative=0), timestamp mask constants,
epochLvc set/get/clear/hasEpochLvc lifecycle, time formatter
constants not null, setTimeFormatter, convertToString non-empty.

PduFactoryExtendedTest (12 tests): default factory construction
and timestamp style, custom TimestampStyle constructor, full
5-parameter constructor (Country, exerciseId, siteId, appId,
TimestampStyle), makeEntityStatePdu with type and timestamp check,
makeFirePdu, makeDetonationPdu, makeCommentPdu with string args
and variable datum count, header consistency across PDU types
(exerciseID match), marshal/unmarshal ByteBuffer round-trip,
createPdu by DisPduType enum, makeCollisionPdu, makeCreateEntityPdu.

DisChannelTest (9 tests): default constructor, descriptor constructor,
default network address (239.1.2.3), default network port (3000),
set network address, set network port, set descriptor, timestamp
style set/get, getPduFactory not null. Tests configuration only,
no network operations.

SimulationManagerTest (11 tests): default constructor, descriptor
constructor, set/clear descriptor, RecordType construction with
4-parameter and 2-parameter constructors, RecordType setters
(id, name, description, reference, alias), entity list add/get/size,
host list add/size, clearAll empties all lists, getPduFactory not
null, addEntity by EntityID.
New test files:
- X3dCoordinatesTest.java (10 tests): default/parameterized constructors,
  all getters/setters, negative values, large DIS geocentric coordinates
- X3dSlidingWindowCompressionTest.java (10 tests): empty/single/two-point
  inputs, collinear point removal, non-collinear retention, time threshold
  trigger, many-point compression, zigzag paths, value preservation,
  input map immutability
- X3dCreateLineSetTest.java (7 tests): constructor, ESPDU byte buffer
  processing, multi-point trajectories, non-ESPDU filtering, empty/populated
  LineSet generation, input buffer clone verification
- PduRecorderTest.java (24 tests): constructor with params, default address/
  port constants, address/port/descriptor setters, encoding defaults and
  switching (PLAINTEXT/BASE64/BINARY), unsupported encoding rejection,
  log file name, output directory, verbose settings (overall/receipt/sending/
  timestamp), readable/zero-based timestamps, include headers, encoding
  constants, encoding options list, comment marker, progressive setter chaining
All tests extend PduTest base class following existing network
send/receive/compare pattern with field-by-field assertEquals.

Warfare family:
- CollisionPduTest: issuingEntityID, collidingEntityID, eventID,
  collisionType, velocity, mass, location, pad
- CollisionElasticPduTest: issuingEntityID, collidingEntityID,
  collisionEventID, contactVelocity, mass, locationOfImpact,
  collisionIntermediateResults (XX/XY/XZ/YY/YZ/ZZ),
  unitSurfaceNormal, coefficientOfRestitution, pad
- DirectedEnergyFirePduTest: firingEntityID, eventID, munitionType,
  shotStartTime, commulativeShotTime, apertureEmitterLocation,
  apertureDiameter, wavelength, pulseRepititionFrequency,
  pulseWidth, flags, pulseShape, deRecords

Entity information family:
- EntityStateUpdatePduTest: entityID, entityLinearVelocity,
  entityLocation, entityOrientation, entityAppearance,
  variableParameters

Simulation management family:
- CreateEntityPduTest: originatingID, receivingID, requestID
- RemoveEntityPduTest: originatingID, receivingID, requestID
All tests extend PduTest base class with network send/receive/compare
pattern and field-by-field assertEquals following existing style.

- StartResumePduTest: originatingID, receivingID, realWorldTime,
  simulationTime, requestID
- StopFreezePduTest: originatingID, receivingID, realWorldTime,
  reason, frozenBehavior, requestID
- AcknowledgePduTest: originatingID, receivingID, acknowledgeFlag,
  responseFlag, requestID
- ActionRequestPduTest: originatingID, receivingID, requestID,
  actionID, fixedDatums, variableDatums
- ActionResponsePduTest: originatingID, receivingID, requestID,
  requestStatus, fixedDatums, variableDatums
- DataPduTest: originatingID, receivingID, requestID,
  fixedDatums, variableDatums
- DataQueryPduTest: originatingID, receivingID, requestID,
  timeInterval, fixedDatums, variableDatums
- SetDataPduTest: originatingID, receivingID, requestID,
  fixedDatums, variableDatums
- EventReportPduTest: originatingID, receivingID, eventType,
  fixedDatums, variableDatums

Completes simulation management family (11/11 including prior
CreateEntityPduTest and RemoveEntityPduTest).
All tests extend PduTest base class with network send/receive/compare
pattern and field-by-field assertEquals following existing style.

- ServiceRequestPduTest: requestingEntityID, servicingEntityID,
  serviceTypeRequested, supplies
- ResupplyOfferPduTest: receivingEntityID, supplyingEntityID, supplies
- ResupplyReceivedPduTest: receivingEntityID, supplyingEntityID, supplies
- ResupplyCancelPduTest: receivingEntityID, supplyingEntityID
- RepairCompletePduTest: receivingEntityID, repairingEntityID, repair
- RepairResponsePduTest: receivingEntityID, repairingEntityID, repairResult

Completes logistics family (6/6).
All tests extend PduTest base class with network send/receive/compare
pattern and field-by-field assertEquals following existing style.

Radio Communications family (5):
- TransmitterPduTest: header, radioEntityType, transmitState,
  inputSource, antennaLocation, relativeAntennaLocation,
  antennaPatternType, frequency, transmitFrequencyBandwidth,
  power, modulationType, cryptoSystem, cryptoKeyId
- ReceiverPduTest: header, receiverState, receivedPower,
  transmitterEntityId, transmitterRadioId
- IntercomControlPduTest: controlType, communicationsChannelType,
  sourceEntityID, sourceIntercomNumber, transmitLineState, command,
  masterIntercomReferenceID, masterIntercomNumber, masterChannelID,
  intercomParameters
- IntercomSignalPduTest: intercomReferenceID, intercomNumber,
  encodingScheme, tdlType, sampleRate, dataLength, samples, data
- DesignatorPduTest: designatingEntityID, codeName,
  designatedEntityID, designatorCode, designatorPower,
  designatorWavelength, designatorSpotWrtDesignated,
  designatorSpotLocation, deadReckoningAlgorithm,
  entityLinearAcceleration

Distributed Emissions family (3):
- ElectromagneticEmissionPduTest: emittingEntityID, eventID,
  stateUpdateIndicator, systems
- UnderwaterAcousticPduTest: emittingEntityID, eventID,
  stateChangeIndicator, passiveParameterIndex, shaftRPMs,
  apaData, emitterSystems
- SEESPduTest: orginatingEntityID, infrared/acoustic/radarCrossSection
  signatureRepresentationIndex, propulsionSystemData, vectoringSystemData

Completes radio communications (5/5) and distributed emissions (3/3).
Entity Information/Interaction family (3 tests):
- EntityDamageStatusPduTest: damagedEntityID, damageDescriptionRecords
- AppearancePduTest: liveEntityId, forceId, entityType, alternateEntityType, entityMarking, capabilities, appearanceFields
- ArticulatedPartsPduTest: liveEntityId, variableParameters

Simulation Management with Reliability family (15 tests):
- CreateEntityReliablePduTest, RemoveEntityReliablePduTest
- StartResumeReliablePduTest, StopFreezeReliablePduTest
- AcknowledgeReliablePduTest
- ActionRequestReliablePduTest, ActionResponseReliablePduTest
- DataReliablePduTest, DataQueryReliablePduTest, SetDataReliablePduTest
- EventReportReliablePduTest, CommentReliablePduTest
- RecordReliablePduTest, SetRecordReliablePduTest, RecordQueryReliablePduTest

All tests follow the original PDU test pattern: extend PduTest,
network send/receive/compare, field-by-field assertEquals validation.
… (13 files)

Synthetic Environment family (5 tests):
- EnvironmentalProcessPduTest: environmentalProcessID, environmentType, modelType, environmentStatus, sequenceNumber, environmentRecords
- GriddedDataPduTest: environmentalSimulationApplicationID, fieldNumber, pduNumber, pduTotal, coordinateSystem, constantGrid, environmentType, orientation, sampleTime, totalValues, vectorDimension
- PointObjectStatePduTest: objectID, updateNumber, forceID, objectType, objectLocation, objectOrientation, specificObjectAppearance, generObjectAppearance, requesterID, receivingID
- LinearObjectStatePduTest: objectID, updateNumber, forceID, objectType, requesterID, receivingID, linearSegmentParameters
- ArealObjectStatePduTest: objectID, updateNumber, forceID, objectType, specificObjectAppearance, generalObjectAppearance, requesterID, receivingID, objectLocation

Entity Management family (4 tests):
- TransferOwnershipPduTest: originatingEntityID, receivingEntityID, requestID, requiredReliabilityService, transferType, transferEntityID, recordSets
- IsGroupOfPduTest: groupEntityID, groupedEntityCategory, latitude, longitude, groupedEntityDescriptions
- IsPartOfPduTest: orginatingEntityID, receivingEntityID, relationship, partLocation, namedLocationID, partEntityType
- AggregateStatePduTest: aggregateID, forceID, aggregateState, aggregateType, formation, aggregateMarking, dimensions, orientation, centerOfMass, velocity, aggregateIDList, entityIDList

Minefield family (4 tests):
- MinefieldStatePduTest: minefieldID, minefieldSequence, forceID, minefieldType, minefieldLocation, minefieldOrientation, appearance, protocolMode, perimeterPoints, mineType
- MinefieldQueryPduTest: minefieldID, requestingEntityID, requestID, dataFilter, requestedMineType, sensorTypes
- MinefieldDataPduTest: minefieldID, requestingEntityID, minefieldSequenceNumbeer, requestID, pduSequenceNumber, numberOfPdus, dataFilter, mineType, sensorTypes, mineLocation
- MinefieldResponseNACKPduTest: minefieldID, requestingEntityID, requestID, missingPduSequenceNumbers

All tests follow the original PDU test pattern: extend PduTest,
network send/receive/compare, field-by-field assertEquals validation.
…iles)

Information Operations family (2 tests):
- InformationOperationsActionPduTest: originatingSimID, receivingSimID, requestID, ioWarfareType, ioActionType, ioActionPhase, ioAttackerID, ioPrimaryTargetID, ioRecords
- InformationOperationsReportPduTest: originatingSimID, ioSimSource, ioReportType, ioAttackerID, ioPrimaryTargetID, ioRecords

Live Entity family (3 tests):
- LiveEntityFirePduTest (LEFirePdu): firingLiveEntityId, targetLiveEntityId, munitionLiveEntityId, eventId, location, munitionDescriptor, velocity, range
- LiveEntityDetonationPduTest (LEDetonationPdu): firingLiveEntityId, targetLiveEntityId, munitionLiveEntityId, eventId, worldLocation, velocity, munitionOrientation, munitionDescriptor, entityLocation, detonationResult
- TSPIPduTest: liveEntityId, tspiFlag, entityLocation, entityLinearVelocity, entityOrientation, positionError, orientationError, deadReckoningParameters, measuredSpeed, systemSpecificData

Attribute family (1 test):
- AttributePduTest: originatingSimulationAddress, attributeRecordPduType, attributeRecordProtocolVersion, masterAttributeRecordType, actionCode, attributeRecordSets

All tests follow the original PDU test pattern: extend PduTest,
network send/receive/compare, field-by-field assertEquals validation.
Note: IFF/Identification already covered by existing IFFPduTest.
RangeCoordinatesTest: 11 tests covering DIS-to-local and local-to-DIS
coordinate conversions, round-trip accuracy, known WGS-84 reference
points (equator/prime meridian, equator/90E, north pole), in-place
vector conversion methods, and local offset distance validation.

EntityBodyCoordinatesTest: 4 tests covering lococentric Euclidean
body-centric reference frame construction with identity axes, offset
origin, rotated axes (45-degree), and different parent SRF locations.
Correct API usage across test files to match generated source:
- SimulationIdentifier: use setSimulationAddress(SimulationAddress)
  instead of non-existent setSiteID/setApplicationID
- ClockTime: use setTimePastHour instead of setTimePastTheHour
- EntityType: use EntityKind enum, Domain.inst(PlatformDomain),
  and Country enum instead of raw byte/int values
- ObjectType: use PlatformDomain and ObjectKind enums
- AggregateType: use AggregateStateAggregateKind enum
- FixedDatum/VariableDatum: use VariableRecordType enum
- IntercomControlControlType: use correct enum names
- StopFreezeReason: use valid enum values (RECESS, TERMINATION)
- StopFreezeFrozenBehavior: use constructor (DisBitSet, not enum)
- SimulationManager.RecordType: access via enclosing instance
- CommentPdu: use getVariableDatums() not getVariableDatumRecords()
- X3dCreateLineSetTest: add throws Exception for marshal() calls

Verified: ant all succeeds in eclipse-temurin:17-jdk container.
@ricklentz ricklentz requested a review from brutzman January 29, 2026 23:07
Copy link
Copy Markdown
Contributor

@brutzman brutzman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a README.tests.md to this directory that notes which tests were originally created by hand. PduTests.java is the abstract superclass that captures the primary patterns of interest.

@brutzman brutzman merged commit f448f36 into master Feb 2, 2026
1 check passed
@brutzman brutzman deleted the test/add-unit-tests branch February 2, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants