mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-24 21:13:50 +00:00
Fixed NullPointerException in MarkPassing tests.
This commit is contained in:
1 parent
b7c805d341
commit
a2051c1903
6 files changed
+19
-16
No files matched your search
+6
-3
@@ -127,10 +127,13 @@ public abstract class AbstractTracTracLiveTest extends StoredTrackBasedTest impl
|
||||
logger.info("entering "+getClass().getName()+".tearDown()");
|
||||
Thread.sleep(500); // wait a bit before stopping the controller; in earlier versions we did a web request to stop the
|
||||
// simulator here; then, the ioThread joined flawlessly; aggressively stopping the controller doesn't let the ioThread join
|
||||
controller.stop(/* abortStored */ true);
|
||||
logger.info("successfully stopped controller");
|
||||
if (getController() != null)
|
||||
controller.stop(/* abortStored */ true);
|
||||
logger.info("successfully stopped controller");
|
||||
try {
|
||||
ioThread.join(3000); // just wait a little bit, then give up
|
||||
if (ioThread != null) {
|
||||
ioThread.join(3000); // just wait a little bit, then give up
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
|
||||
+4
-4
@@ -78,11 +78,11 @@ public class FlorianopolisMarkPassingTest extends OnlineTracTracBasedTest {
|
||||
int incorrectPasses = 0;
|
||||
|
||||
boolean printRight = false;
|
||||
boolean printWrong = true;
|
||||
boolean printWrong = false;
|
||||
|
||||
for (Competitor c : getRace().getCompetitors()) {
|
||||
numberOfCompetitors++;
|
||||
System.out.println(c.getName() + "\n");
|
||||
// System.out.println(c.getName() + "\n");
|
||||
for (Waypoint w : waypoints) {
|
||||
if (givenPasses.get(c).get(w) == null && !(computedPasses.get(c).get(w) == null)) {
|
||||
wronglyComputed++;
|
||||
@@ -131,15 +131,15 @@ public class FlorianopolisMarkPassingTest extends OnlineTracTracBasedTest {
|
||||
int totalMarkPasses = numberOfCompetitors * waypoints.size();
|
||||
assertEquals(totalMarkPasses, incorrectPasses + correctPasses + wronglyNotComputed + correctlyNotComputed
|
||||
+ wronglyComputed);
|
||||
System.out.println("Total theoretical Passes: " + totalMarkPasses);
|
||||
double accuracy = (double) (correctPasses + correctlyNotComputed) / totalMarkPasses;
|
||||
/* System.out.println("Total theoretical Passes: " + totalMarkPasses);
|
||||
System.out.println("Correct comparison: " + correctPasses);
|
||||
System.out.println("Incorrect comparison: " + incorrectPasses);
|
||||
System.out.println("Correctly Null: " + correctlyNotComputed);
|
||||
System.out.println("Should be null but arent:" + wronglyComputed);
|
||||
System.out.println("Should not be null but are: " + wronglyNotComputed);
|
||||
System.out.println("accuracy: " + accuracy);
|
||||
System.out.println("Computation time: " + time + " ms");
|
||||
System.out.println("Computation time: " + time + " ms");*/
|
||||
assertTrue(accuracy >= 0.9);
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -41,12 +41,12 @@ public class FlorianopolisStartOfRaceTest extends FlorianopolisMarkPassingTest {
|
||||
}
|
||||
finder.calculateFixesAffectedByNewCompetitorFixes(c, fixes);
|
||||
chooser.calculateMarkPassDeltas(c, finder.getCandidateDeltas(c));
|
||||
System.out.println("\n"+c);
|
||||
// System.out.println("\n"+c);
|
||||
Waypoint w1 = getRace().getCourse().getFirstWaypoint();
|
||||
boolean gotFirst=false;
|
||||
boolean gotOther=false;
|
||||
for (Waypoint w : getRace().getCourse().getWaypoints()) {
|
||||
System.out.println(getTrackedRace().getMarkPassing(c, w));
|
||||
// System.out.println(getTrackedRace().getMarkPassing(c, w));
|
||||
if(w==w1){
|
||||
gotFirst = (getTrackedRace().getMarkPassing(c, w) != null) ? true : false;
|
||||
} else {
|
||||
|
||||
+4
-4
@@ -78,11 +78,11 @@ public class OBMRMarkPassingTest extends OnlineTracTracBasedTest {
|
||||
int incorrectPasses = 0;
|
||||
|
||||
boolean printRight = false;
|
||||
boolean printWrong = true;
|
||||
boolean printWrong = false;
|
||||
|
||||
for (Competitor c : getRace().getCompetitors()) {
|
||||
numberOfCompetitors++;
|
||||
System.out.println(c.getName() + "\n");
|
||||
//System.out.println(c.getName() + "\n");
|
||||
for (Waypoint w : waypoints) {
|
||||
if (givenPasses.get(c).get(w) == null && !(computedPasses.get(c).get(w) == null)) {
|
||||
wronglyComputed++;
|
||||
@@ -131,15 +131,15 @@ public class OBMRMarkPassingTest extends OnlineTracTracBasedTest {
|
||||
int totalMarkPasses = numberOfCompetitors * waypoints.size();
|
||||
assertEquals(totalMarkPasses, incorrectPasses + correctPasses + wronglyNotComputed + correctlyNotComputed
|
||||
+ wronglyComputed);
|
||||
System.out.println("Total theoretical Passes: " + totalMarkPasses);
|
||||
double accuracy = (double) (correctPasses + correctlyNotComputed) / totalMarkPasses;
|
||||
/* System.out.println("Total theoretical Passes: " + totalMarkPasses);
|
||||
System.out.println("Correct comparison: " + correctPasses);
|
||||
System.out.println("Incorrect comparison: " + incorrectPasses);
|
||||
System.out.println("Correctly Null: " + correctlyNotComputed);
|
||||
System.out.println("Should be null but arent:" + wronglyComputed);
|
||||
System.out.println("Should not be null but are: " + wronglyNotComputed);
|
||||
System.out.println("accuracy: " + accuracy);
|
||||
System.out.println("Computation time: " + time + " ms");
|
||||
System.out.println("Computation time: " + time + " ms");*/
|
||||
assertTrue(accuracy >= 0.9);
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -41,12 +41,12 @@ public class OBMRStartOfRaceTest extends OBMRMarkPassingTest {
|
||||
}
|
||||
finder.calculateFixesAffectedByNewCompetitorFixes(c, fixes);
|
||||
chooser.calculateMarkPassDeltas(c, finder.getCandidateDeltas(c));
|
||||
System.out.println("\n"+c);
|
||||
// System.out.println("\n"+c);
|
||||
Waypoint w1 = getRace().getCourse().getFirstWaypoint();
|
||||
boolean gotFirst=false;
|
||||
boolean gotOther=false;
|
||||
for (Waypoint w : getRace().getCourse().getWaypoints()) {
|
||||
System.out.println(getTrackedRace().getMarkPassing(c, w));
|
||||
// System.out.println(getTrackedRace().getMarkPassing(c, w));
|
||||
if(w==w1){
|
||||
gotFirst = (getTrackedRace().getMarkPassing(c, w) != null) ? true : false;
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user