java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/CourseChangeBasedTrackApproximationWithTracTracDataTest.java
... ...
@@ -10,6 +10,7 @@ import java.net.URISyntaxException;
10 10
import java.net.URL;
11 11
import java.util.Iterator;
12 12
import java.util.Random;
13
+import java.util.logging.Logger;
13 14
14 15
import org.junit.jupiter.api.BeforeEach;
15 16
import org.junit.jupiter.api.Test;
... ...
@@ -25,6 +26,8 @@ import com.sap.sse.common.TimePoint;
25 26
import com.sap.sse.common.Util;
26 27
27 28
public class CourseChangeBasedTrackApproximationWithTracTracDataTest extends OnlineTracTracBasedTest {
29
+ private static final Logger logger = Logger.getLogger(CourseChangeBasedTrackApproximationWithTracTracDataTest.class.getName());
30
+
28 31
private Iterable<Competitor> competitors;
29 32
private CompetitorWithBoat sampleCompetitor;
30 33
private DynamicGPSFixTrack<Competitor, GPSFixMoving> sampleTrack;
... ...
@@ -40,19 +43,35 @@ public class CourseChangeBasedTrackApproximationWithTracTracDataTest extends Onl
40 43
super.setUp(
41 44
new URL("file:///" + new File("resources/event_20110609_KielerWoch-505_Race_2.txt").getCanonicalPath()),
42 45
/* liveUri */ null, /* storedUri */ storedUri,
43
- new ReceiverType[] { ReceiverType.RACECOURSE, ReceiverType.RAWPOSITIONS });
46
+ new ReceiverType[] { ReceiverType.RACECOURSE, ReceiverType.RAWPOSITIONS, ReceiverType.MARKPASSINGS });
44 47
getTrackedRace().waitUntilNotLoading();
45 48
assertFalse(Util.isEmpty(getTrackedRace().getRace().getCompetitors()));
46 49
do {
47 50
competitors = getTrackedRace().getRace().getCompetitors();
48 51
// To pick a single competitor, e.g., for debugging, use the following line:
49
-// sampleCompetitor = (CompetitorWithBoat) Util.first(Util.filter(competitors, c->c.getName().equals("Dasenbrook")));
52
+// sampleCompetitor = (CompetitorWithBoat) Util.first(Util.filter(competitors, c->c.getName().equals("Feldmann")));
50 53
// To pick a random competitor, use the following line:
51
- sampleCompetitor = (CompetitorWithBoat) Util.get(competitors, new Random().nextInt(Util.size(competitors)));
54
+ sampleCompetitor = (CompetitorWithBoat) Util.get(
55
+ Util.filter(competitors,
56
+ c -> getTrackedRace().getMarkPassing(c,
57
+ getTrackedRace().getRace().getCourse().getLastWaypoint()) != null),
58
+ new Random().nextInt(Util.size(competitors)));
52 59
sampleTrack = getTrackedRace().getTrack(sampleCompetitor);
53 60
} while (sampleTrack.isEmpty());
54 61
}
55 62
63
+ @Test
64
+ public void testAllCompetitorsThatFinished() {
65
+ for (final Competitor competitor : Util.filter(competitors,
66
+ c -> !c.getName().equals("Broise") &&
67
+ getTrackedRace().getMarkPassing(c, getTrackedRace().getRace().getCourse().getLastWaypoint()) != null)) {
68
+ sampleCompetitor = (CompetitorWithBoat) competitor;
69
+ sampleTrack = getTrackedRace().getTrack(sampleCompetitor);
70
+ logger.info("Testing competitor "+sampleCompetitor.getName());
71
+ testNoDiffBetweenEarlyAndLateInitialization();
72
+ }
73
+ }
74
+
56 75
/**
57 76
* During the work on bug5959 (https://bugzilla.sapsailing.com/bugzilla/show_bug.cgi?id=5959) we identified an issue
58 77
* with early vs. late initialization of the approximation. When initializing the
... ...
@@ -95,7 +114,10 @@ public class CourseChangeBasedTrackApproximationWithTracTracDataTest extends Onl
95 114
while (earlyIter.hasNext() && lateIter.hasNext()) {
96 115
final GPSFixMoving earlyFix = earlyIter.next();
97 116
final GPSFixMoving lateFix = lateIter.next();
98
- assertEquals(earlyFix.getTimePoint(), lateFix.getTimePoint(), "Time points of approximation fixes differ at index "+i+" for competitor "+sampleCompetitor.getName());
117
+ if (earlyFix.getTimePoint().after(getTrackedRace().getStartOfRace()) && lateFix.getTimePoint().after(getTrackedRace().getStartOfRace())
118
+ && earlyFix.getTimePoint().before(getTrackedRace().getEndOfRace()) && lateFix.getTimePoint().before(getTrackedRace().getEndOfRace())) {
119
+ assertEquals(earlyFix.getTimePoint(), lateFix.getTimePoint(), "Time points of approximation fixes differ at index "+i+" for competitor "+sampleCompetitor.getName());
120
+ }
99 121
i++;
100 122
}
101 123
assertEquals(Util.size(earlyInitResult), Util.size(lateInitResult), "Different numbers of approximation points for competitor "+sampleCompetitor.getName());