diff --git a/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Detector.java b/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Detector.java index 42e12df8..d82ef91d 100644 --- a/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Detector.java +++ b/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Detector.java @@ -145,6 +145,13 @@ public boolean equals(Object obj) { return true; } + @Override + public String toString() { + return "Detector [sensorId=" + sensorId + ", type=" + type + ", orientation=" + orientation + ", location=" + + location + "]"; + } + + } diff --git a/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Orientation.java b/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Orientation.java index ea902bb5..5ed1ddbc 100644 --- a/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Orientation.java +++ b/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Orientation.java @@ -94,6 +94,13 @@ public boolean equals(Object obj) { return true; } + @Override + public String toString() { + return "Orientation [yaw=" + yaw + ", pitch=" + pitch + ", roll=" + roll + "]"; + } + + + } diff --git a/co-simulation/lib/mosaic-objects/src/test/java/org/eclipse/mosaic/lib/objects/detector/DetectorTest.java b/co-simulation/lib/mosaic-objects/src/test/java/org/eclipse/mosaic/lib/objects/detector/DetectorTest.java index 689880c7..ad1482e6 100644 --- a/co-simulation/lib/mosaic-objects/src/test/java/org/eclipse/mosaic/lib/objects/detector/DetectorTest.java +++ b/co-simulation/lib/mosaic-objects/src/test/java/org/eclipse/mosaic/lib/objects/detector/DetectorTest.java @@ -98,4 +98,15 @@ public void testGetterSetterConstructor() { assertEquals(new Orientation(22, 33, 44), sensor.getOrientation()); assertEquals(CartesianPoint.xy(45,67), sensor.getLocation()); } + @Test + public void testToString() { + Detector sensor = new Detector("something", DetectorType.SEMANTIC_LIDAR, new Orientation(23.0, 0, 0), + CartesianPoint.xyz(1, 2, 3)); + String sensoString = "Detector [sensorId=something, type=SEMANTIC_LIDAR, " + + "orientation=Orientation [yaw=23.0, pitch=0.0, roll=0.0], " + + "location=CartesianPoint{x=1.00,y=2.00,z=3.00}]"; + assertEquals(sensoString, sensor.toString()); + } } + +