mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-20 04:35:32 +00:00
bug6127: first step migrating tests from JUnit4 to JUnit5
This commit is contained in:
+2
-2
@@ -1,8 +1,8 @@
|
||||
package com.sap.sailing.windestimation.aggregator.hmm;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sailing.windestimation.aggregator.hmm.WindCourseRange.CombinationModeOnViolation;
|
||||
|
||||
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
package com.sap.sailing.windestimation.aggregator.msthmm;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sailing.windestimation.aggregator.msthmm.AbstractMstGraphGenerator.NodeWithDistance;
|
||||
import com.sap.sailing.windestimation.aggregator.msthmm.AbstractMstGraphGenerator.NodeWithNeighbors;
|
||||
@@ -22,7 +22,7 @@ public class AbstractMstGraphGeneratorTest {
|
||||
|
||||
private int counter;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void beforeStart() {
|
||||
counter = 1;
|
||||
}
|
||||
|
||||
+6
-6
@@ -1,8 +1,8 @@
|
||||
package com.sap.sailing.windestimation.aggregator.msthmm;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -12,8 +12,8 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sailing.windestimation.aggregator.graph.DijkstraShortestPathFinderImpl;
|
||||
import com.sap.sailing.windestimation.aggregator.graph.DijsktraShortestPathFinder;
|
||||
@@ -87,7 +87,7 @@ public class DijkstraTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
startNode = new Node("Start", 1.0);
|
||||
endNode = new Node("End", 1.0);
|
||||
|
||||
+15
-15
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.windestimation.integration;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
@@ -19,8 +19,8 @@ import java.util.TimeZone;
|
||||
import java.util.TreeMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.NoWindException;
|
||||
@@ -112,7 +112,7 @@ public class IncrementalMstHmmWindEstimationForTrackedRaceTest extends OnlineTra
|
||||
windEstimationFactoryService.importAllModelsFromModelStore(modelStore);
|
||||
}
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
URI storedUri = new URI("file:///"
|
||||
@@ -149,7 +149,7 @@ public class IncrementalMstHmmWindEstimationForTrackedRaceTest extends OnlineTra
|
||||
|
||||
@Test
|
||||
public void testIncrementalMstHmmWindEstimationForTrackedRace() throws NoWindException, ModelPersistenceException {
|
||||
assertTrue("Wind estimation models are empty", windEstimationFactoryService.isReady());
|
||||
assertTrue(windEstimationFactoryService.isReady(), "Wind estimation models are empty");
|
||||
DynamicTrackedRaceImpl trackedRace = getTrackedRace();
|
||||
WindTrack estimatedWindTrackOfTrackedRace = trackedRace
|
||||
.getOrCreateWindTrack(new WindSourceImpl(WindSourceType.MANEUVER_BASED_ESTIMATION));
|
||||
@@ -223,16 +223,16 @@ public class IncrementalMstHmmWindEstimationForTrackedRaceTest extends OnlineTra
|
||||
foundCount++;
|
||||
}
|
||||
}
|
||||
assertTrue("Expected ratio of matching fixes to be at least "+PERCENT_QUANTILE+" but was only "+(double) foundCount / (double) estimatedWindFixes.size(),
|
||||
(double) foundCount / (double) estimatedWindFixes.size() > PERCENT_QUANTILE);
|
||||
assertTrue((double) foundCount / (double) estimatedWindFixes.size() > PERCENT_QUANTILE,
|
||||
"Expected ratio of matching fixes to be at least "+PERCENT_QUANTILE+" but was only "+(double) foundCount / (double) estimatedWindFixes.size());
|
||||
foundCount = 0;
|
||||
for (Wind wind : targetWindFixes) {
|
||||
if (findWithinTolerance(estimatedWindFixesMap, new Pair<>(wind.getPosition(), wind.getTimePoint())) != null) {
|
||||
foundCount++;
|
||||
}
|
||||
}
|
||||
assertTrue("Expected ratio of matching fixes to be at least "+PERCENT_QUANTILE+" but was only "+(double) foundCount / (double) estimatedWindFixes.size(),
|
||||
(double) foundCount / (double) targetWindFixes.size() > PERCENT_QUANTILE);
|
||||
assertTrue((double) foundCount / (double) targetWindFixes.size() > PERCENT_QUANTILE,
|
||||
"Expected ratio of matching fixes to be at least "+PERCENT_QUANTILE+" but was only "+(double) foundCount / (double) estimatedWindFixes.size());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -269,11 +269,11 @@ public class IncrementalMstHmmWindEstimationForTrackedRaceTest extends OnlineTra
|
||||
}
|
||||
}
|
||||
final Bearing averageBearing = bearingSum.divide(targetWindFixes.size());
|
||||
assertTrue("Expected at least "+((int) (100*PERCENT_QUANTILE))+"% of the wind fixes to be in range "+
|
||||
new DegreeBearingImpl(expectedTWDAverageInDegrees).add(new DegreeBearingImpl(-toleranceForPercentQuantile))+
|
||||
" to "+new DegreeBearingImpl(expectedTWDAverageInDegrees).add(new DegreeBearingImpl(toleranceForPercentQuantile))+
|
||||
" but only "+(int) (100*(double) insideRange / targetWindFixes.size())+"% were.",
|
||||
(double) insideRange / targetWindFixes.size() >= PERCENT_QUANTILE);
|
||||
assertTrue((double) insideRange / targetWindFixes.size() >= PERCENT_QUANTILE,
|
||||
"Expected at least "+((int) (100*PERCENT_QUANTILE))+"% of the wind fixes to be in range "+
|
||||
new DegreeBearingImpl(expectedTWDAverageInDegrees).add(new DegreeBearingImpl(-toleranceForPercentQuantile))+
|
||||
" to "+new DegreeBearingImpl(expectedTWDAverageInDegrees).add(new DegreeBearingImpl(toleranceForPercentQuantile))+
|
||||
" but only "+(int) (100*(double) insideRange / targetWindFixes.size())+"% were.");
|
||||
assertEquals(expectedTWDAverageInDegrees, averageBearing.getDegrees(), averageToleranceInDegrees);
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -1,6 +1,6 @@
|
||||
package com.sap.sailing.windestimation.integration;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
@@ -15,8 +15,8 @@ import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
@@ -59,7 +59,7 @@ public class IncrementalMstManeuverGraphGeneratorTest extends OnlineTracTracBase
|
||||
IncrementalMstHmmWindEstimationForTrackedRaceTest.modelFilesNames);
|
||||
}
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
URI storedUri = new URI("file:///"
|
||||
@@ -81,8 +81,8 @@ public class IncrementalMstManeuverGraphGeneratorTest extends OnlineTracTracBase
|
||||
gaussianBasedTwdTransitionDistributionCache, true);
|
||||
ManeuverClassifiersCache maneuverClassifiersCache = new ManeuverClassifiersCache(modelStore, true,
|
||||
Long.MAX_VALUE, new ManeuverFeatures(false, false, false));
|
||||
assertTrue("Wind estimation models are empty",
|
||||
gaussianBasedTwdTransitionDistributionCache.isReady() && maneuverClassifiersCache.isReady());
|
||||
assertTrue(gaussianBasedTwdTransitionDistributionCache.isReady() && maneuverClassifiersCache.isReady(),
|
||||
"Wind estimation models are empty");
|
||||
DynamicTrackedRaceImpl trackedRace = getTrackedRace();
|
||||
IncrementalMstManeuverGraphGenerator generator = new IncrementalMstManeuverGraphGenerator(
|
||||
new CompleteManeuverCurveToManeuverForEstimationConverter(trackedRace, null),
|
||||
@@ -133,10 +133,10 @@ public class IncrementalMstManeuverGraphGeneratorTest extends OnlineTracTracBase
|
||||
.forEach(pair -> cleanManeuversFromGraph.add(pair));
|
||||
|
||||
for (Pair<Position, TimePoint> pair : cleanManeuversFromGraph) {
|
||||
assertTrue("Target set does not contain maneuver at " + pair, cleanManeuvers.contains(pair));
|
||||
assertTrue(cleanManeuvers.contains(pair), "Target set does not contain maneuver at " + pair);
|
||||
}
|
||||
for (Pair<Position, TimePoint> pair : cleanManeuvers) {
|
||||
assertTrue("Set from graph does not contain maneuver at " + pair, cleanManeuversFromGraph.contains(pair));
|
||||
assertTrue(cleanManeuversFromGraph.contains(pair), "Set from graph does not contain maneuver at " + pair);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package com.sap.sailing.windestimation.jaxrs.api;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sailing.windestimation.integration.IncrementalMstHmmWindEstimationForTrackedRaceTest;
|
||||
import com.sap.sailing.windestimation.integration.WindEstimationFactoryServiceImpl;
|
||||
|
||||
Reference in New Issue
Block a user