7ca8529be97c163217f0915b85cfa52710109d85
java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/CourseChangeBasedTrackApproximationWithTracTracDataTest.java
| ... | ... | @@ -51,26 +51,27 @@ public class CourseChangeBasedTrackApproximationWithTracTracDataTest extends Onl |
| 51 | 51 | // To pick a single competitor, e.g., for debugging, use the following line: |
| 52 | 52 | // sampleCompetitor = (CompetitorWithBoat) Util.first(Util.filter(competitors, c->c.getName().equals("Feldmann"))); |
| 53 | 53 | // To pick a random competitor, use the following line: |
| 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))); |
|
| 54 | + final Iterable<Competitor> validCompetitors = getValidCompetitors(); |
|
| 55 | + sampleCompetitor = (CompetitorWithBoat) Util.get(validCompetitors, new Random().nextInt(Util.size(validCompetitors))); |
|
| 59 | 56 | sampleTrack = getTrackedRace().getTrack(sampleCompetitor); |
| 60 | 57 | } while (sampleTrack.isEmpty()); |
| 61 | 58 | } |
| 62 | 59 | |
| 63 | 60 | @Test |
| 64 | 61 | 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)) { |
|
| 62 | + for (final Competitor competitor : getValidCompetitors()) { |
|
| 68 | 63 | sampleCompetitor = (CompetitorWithBoat) competitor; |
| 69 | 64 | sampleTrack = getTrackedRace().getTrack(sampleCompetitor); |
| 70 | 65 | logger.info("Testing competitor "+sampleCompetitor.getName()); |
| 71 | 66 | testNoDiffBetweenEarlyAndLateInitialization(); |
| 72 | 67 | } |
| 73 | 68 | } |
| 69 | + |
|
| 70 | + private Iterable<Competitor> getValidCompetitors() { |
|
| 71 | + return Util.filter(competitors, |
|
| 72 | + c -> !c.getName().equals("Broise") && // Broise has major gaps in the track, leading to deviations, not relevant for production, so exclude them |
|
| 73 | + getTrackedRace().getMarkPassing(c, getTrackedRace().getRace().getCourse().getLastWaypoint()) != null); |
|
| 74 | + } |
|
| 74 | 75 | |
| 75 | 76 | /** |
| 76 | 77 | * During the work on bug5959 (https://bugzilla.sapsailing.com/bugzilla/show_bug.cgi?id=5959) we identified an issue |