bug6127: more JUnit5 migrations; still to do: selenium and domain.test

This commit is contained in:
Axel Uhl
2025-06-05 17:21:26 +02:00
parent f6d91886ed
commit 5b2536e9c0
158 changed files with 367 additions and 348 deletions
@@ -16,7 +16,11 @@ Require-Bundle: com.sap.sailing.domain,
com.sap.sse.mongodb,
com.tractrac.clientmodule;bundle-version="2.0.0",
org.hamcrest;bundle-version="2.2.0",
org.junit;bundle-version="4.8.2",
junit-jupiter-api;bundle-version="5.12.2",
junit-jupiter-engine;bundle-version="5.12.2",
junit-platform-commons;bundle-version="1.12.2",
junit-platform-engine;bundle-version="1.12.2",
org.opentest4j;bundle-version="1.3.0",
com.sap.sailing.domain.test,
org.mockito.mockito-core;bundle-version="1.10.14",
com.sap.sse.common,
@@ -1,5 +1,7 @@
package com.sap.sailing.server.anniversary;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
@@ -90,15 +92,19 @@ public class AnniversaryQuarterCheckerTest {
* Tests that no runaway loop can happen, if the anniversary to check overflows internally. The used 1000000000 is
* the first number, that will lead to a overflow, after *10 multiplier is applied, testing for the next anniversary
*/
@Test(expected = IllegalStateException.class)
@Test
public void ensureInCaseOfBugNoFreeze() {
AnniversaryChecker checker = new QuarterChecker();
checker.update(1000000000);
assertThrows(IllegalStateException.class, () -> {
AnniversaryChecker checker = new QuarterChecker();
checker.update(1000000000);
});
}
@Test(expected = IllegalStateException.class)
@Test
public void illegalRaceCountTest() {
AnniversaryChecker checker = new QuarterChecker();
checker.update(-1);
assertThrows(IllegalStateException.class, () -> {
AnniversaryChecker checker = new QuarterChecker();
checker.update(-1);
});
}
}
@@ -1,5 +1,7 @@
package com.sap.sailing.server.anniversary;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
@@ -93,15 +95,19 @@ public class AnniversarySameDigitCheckerTest {
* Tests that no runaway loop can happen, if the anniversary to check overflows internally. It is expected that the
* resulting String cannot be converted to a number anymore if it exceeds IntegerRange.
*/
@Test(expected = NumberFormatException.class)
@Test
public void ensureInCaseOfBugNoFreeze() {
AnniversaryChecker checker = new SameDigitChecker();
checker.update(Integer.MAX_VALUE);
assertThrows(NumberFormatException.class, () -> {
AnniversaryChecker checker = new SameDigitChecker();
checker.update(Integer.MAX_VALUE);
});
}
@Test(expected = IllegalStateException.class)
@Test
public void illegalRaceCountTest() {
AnniversaryChecker checker = new SameDigitChecker();
checker.update(-1);
assertThrows(IllegalStateException.class, () -> {
AnniversaryChecker checker = new SameDigitChecker();
checker.update(-1);
});
}
}
@@ -1,5 +1,7 @@
package com.sap.sailing.server.test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
@@ -7,6 +9,8 @@ import java.util.List;
import java.util.UUID;
import org.bson.Document;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import com.mongodb.BasicDBObject;
@@ -24,18 +28,16 @@ import com.sap.sailing.server.impl.RacingEventServiceImpl;
import com.sap.sailing.server.interfaces.RacingEventService;
import com.sap.sse.mongodb.MongoDBService;
import junit.framework.TestCase;
public class LeaderboardStorageTest extends TestCase {
public class LeaderboardStorageTest {
private static final String LEADERBOARD_NAME = "test";
@Override
@BeforeEach
protected void setUp() throws Exception {
removeTestLeaderboard();
}
@Override
@AfterEach
protected void tearDown() throws Exception {
removeTestLeaderboard();
}