mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-22 21:55:39 +00:00
bug6127: first step migrating tests from JUnit4 to JUnit5
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.sap.see.pairinglist.test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Constructs randomized number sequences of equal length, for each element in the sequence using a random number
|
||||
|
||||
+16
-16
@@ -1,24 +1,24 @@
|
||||
package com.sap.see.pairinglist.test;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sse.pairinglist.PairingListTemplate;
|
||||
import com.sap.sse.pairinglist.impl.PairingListTemplateFactoryImpl;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
public class PairingListTemplateFactoryTest {
|
||||
|
||||
public PairingListTemplateFactoryImpl factoryImpl;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void testSetup() {
|
||||
factoryImpl = new PairingListTemplateFactoryImpl();
|
||||
}
|
||||
@@ -31,11 +31,11 @@ public class PairingListTemplateFactoryTest {
|
||||
int[][] plTemplate = factoryImpl
|
||||
.createPairingListTemplate(new PairingFrameProviderTest(flights, groups, competitors))
|
||||
.getPairingListTemplate();
|
||||
Assert.assertNotNull(plTemplate);
|
||||
Assertions.assertNotNull(plTemplate);
|
||||
for (int[] group : plTemplate) {
|
||||
for (int competitorNumber : group) {
|
||||
if (competitorNumber < 0 && competitorNumber < competitors) {
|
||||
Assert.fail("Values of Pairing List Template must not be smaller 0, when there are no dummies!");
|
||||
Assertions.fail("Values of Pairing List Template must not be smaller 0, when there are no dummies!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,19 +43,19 @@ public class PairingListTemplateFactoryTest {
|
||||
.createPairingListTemplate(new PairingFrameProviderTest(flights, groups, competitors + 1))
|
||||
.getPairingListTemplate();
|
||||
int dummyCount = 0;
|
||||
Assert.assertNotNull(plTemplate2);
|
||||
Assertions.assertNotNull(plTemplate2);
|
||||
for (int[] group : plTemplate2) {
|
||||
for (int competitorNumber : group) {
|
||||
if (competitorNumber == -1) {
|
||||
dummyCount++;
|
||||
}
|
||||
if (competitorNumber < -1 && competitorNumber < competitors) {
|
||||
Assert.fail("Values of Pairing List Template must not be smaller -1, when there are dummies!");
|
||||
Assertions.fail("Values of Pairing List Template must not be smaller -1, when there are dummies!");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dummyCount != (groups - 1) * flights) {
|
||||
Assert.fail("There are not as much dummies as there should be!");
|
||||
Assertions.fail("There are not as much dummies as there should be!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class PairingListTemplateFactoryTest {
|
||||
PairingListTemplate template1 = factoryImpl.createPairingListTemplate(new PairingFrameProviderTest(15, 3, 18));
|
||||
PairingListTemplate template2 = factoryImpl.createPairingListTemplate(new PairingFrameProviderTest(15, 3, 18));
|
||||
|
||||
Assert.assertFalse(Arrays.equals(template1.getPairingListTemplate(), template2.getPairingListTemplate()));
|
||||
Assertions.assertFalse(Arrays.equals(template1.getPairingListTemplate(), template2.getPairingListTemplate()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,14 +114,14 @@ public class PairingListTemplateFactoryTest {
|
||||
System.out.println(Arrays.deepToString(template.getPairingListTemplate()));
|
||||
System.out.println(template.getQuality());
|
||||
if (template.getQuality() >= 0.7) {
|
||||
Assert.fail("Quality of Pairinglist is worse than usual!");
|
||||
Assertions.fail("Quality of Pairinglist is worse than usual!");
|
||||
}
|
||||
|
||||
PairingListTemplate template2 = factoryImpl.createPairingListTemplate(new PairingFrameProviderTest(10, 3, 30));
|
||||
System.out.println(Arrays.deepToString(template2.getPairingListTemplate()));
|
||||
System.out.println(template2.getQuality());
|
||||
if (template2.getQuality() >= 1.2) {
|
||||
Assert.fail("Quality of Pairinglist is worse than usual!");
|
||||
Assertions.fail("Quality of Pairinglist is worse than usual!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public class PairingListTemplateFactoryTest {
|
||||
if (availableCompetitors.isEmpty()) {
|
||||
continue;
|
||||
} else {
|
||||
Assert.fail("The competitors are not divided up correctly!");
|
||||
Assertions.fail("The competitors are not divided up correctly!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-12
@@ -1,15 +1,14 @@
|
||||
package com.sap.see.pairinglist.test;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sse.pairinglist.impl.PairingListTemplateImpl;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
public class PairingListTemplateTest extends PairingListTemplateImpl {
|
||||
|
||||
public PairingListTemplateTest() {
|
||||
@@ -28,10 +27,10 @@ public class PairingListTemplateTest extends PairingListTemplateImpl {
|
||||
for (int x = 0; x < associations.length; x++) {
|
||||
for (int y = 0; y < associations[0].length; y++) {
|
||||
if ((x == y) && (associations[x][y] != -1)) {
|
||||
Assert.fail("The diagonal of association matrix has to be -1.");
|
||||
Assertions.fail("The diagonal of association matrix has to be -1.");
|
||||
}
|
||||
if (associations[x][y] > flights && (associations[x][y] < -1)) {
|
||||
Assert.fail("Calculation of assosciation matrix failed!");
|
||||
Assertions.fail("Calculation of assosciation matrix failed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,7 +55,7 @@ public class PairingListTemplateTest extends PairingListTemplateImpl {
|
||||
double average = sum / tests + 1;
|
||||
System.out.println("Average Time: " + (average / 1000) + "s");
|
||||
if (average > 10000) {
|
||||
Assert.fail("The calculation of Pairing Lists took longer than expected!");
|
||||
Assertions.fail("The calculation of Pairing Lists took longer than expected!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +73,7 @@ public class PairingListTemplateTest extends PairingListTemplateImpl {
|
||||
for (double quality : results) {
|
||||
sum += quality;
|
||||
}
|
||||
Assert.assertEquals(0.574, sum / count, 0.01);
|
||||
Assertions.assertEquals(0.574, sum / count, 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -87,7 +86,7 @@ public class PairingListTemplateTest extends PairingListTemplateImpl {
|
||||
for (int[] key : associations) {
|
||||
for (int value : key) {
|
||||
if (value > 0) {
|
||||
Assert.fail("Associations array should only have values 0 and -1!");
|
||||
Assertions.fail("Associations array should only have values 0 and -1!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,10 +106,10 @@ public class PairingListTemplateTest extends PairingListTemplateImpl {
|
||||
{ 17, 4, 5, 16, 8, 6 }, { 17, 4, 12, 15, 10, 7 }, { 3, 1, 11, 0, 8, 16 }, { 2, 9, 6, 5, 13, 14 },
|
||||
{ 0, 9, 17, 5, 3, 15 }, { 12, 7, 1, 13, 16, 6 }, { 10, 14, 2, 8, 11, 4 }, { 7, 14, 2, 17, 3, 16 },
|
||||
{ 15, 5, 10, 11, 1, 6 }, { 4, 12, 8, 9, 0, 13 } };
|
||||
Assert.assertEquals(0.5998846486579744,
|
||||
Assertions.assertEquals(0.5998846486579744,
|
||||
calcStandardDev(incrementAssociations(givenPairingList, new int[18][18])), 0.0);
|
||||
int[][] testPairingList = { { 0, 1, 2, 3, 4 }, { 5, 6, 7, 8, 9 } };
|
||||
Assert.assertEquals(0.4967673, (calcStandardDev(incrementAssociations(testPairingList, new int[10][10]))),
|
||||
Assertions.assertEquals(0.4967673, (calcStandardDev(incrementAssociations(testPairingList, new int[10][10]))),
|
||||
0.01);
|
||||
}
|
||||
|
||||
@@ -146,6 +145,6 @@ public class PairingListTemplateTest extends PairingListTemplateImpl {
|
||||
{ 17, 4, 5, 16, 8, 6 }, { 17, 4, 12, 15, 10, 7 }, { 3, 1, 11, 0, 8, 16 }, { 2, 9, 6, 5, 13, 14 },
|
||||
{ 0, 9, 17, 5, 3, 15 }, { 12, 7, 1, 13, 16, 6 }, { 10, 14, 2, 8, 11, 4 }, { 7, 14, 2, 17, 3, 16 },
|
||||
{ 15, 5, 10, 11, 1, 6 }, { 4, 12, 8, 9, 0, 13 } };
|
||||
Assert.assertEquals(56,this.getBoatChangesFromPairingList(givenPairingList, 15, 3, 18));
|
||||
Assertions.assertEquals(56,this.getBoatChangesFromPairingList(givenPairingList, 15, 3, 18));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.sap.sse.i18n.impl;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* A class whose {@link #main(String[])} method can be used to convert a .properties file written in the conventions as
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sse.util.ThreadPoolUtil;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -14,7 +14,7 @@ import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.internal.verification.VerificationModeFactory;
|
||||
|
||||
import com.sap.sse.rest.CORSFilter;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
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 java.lang.management.ManagementFactory;
|
||||
import java.lang.management.ThreadMXBean;
|
||||
@@ -9,16 +9,16 @@ import java.util.function.IntConsumer;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class CPUTimeMeasurementTest {
|
||||
private static final Logger logger = Logger.getLogger(CPUTimeMeasurementTest.class.getName());
|
||||
|
||||
private final static ThreadMXBean threadMxBean = ManagementFactory.getThreadMXBean();
|
||||
|
||||
@BeforeClass
|
||||
@BeforeAll
|
||||
public static void setUp() {
|
||||
logger.info("CPU time enabled by default: "+threadMxBean.isThreadCpuTimeEnabled());
|
||||
if (!threadMxBean.isThreadCpuTimeEnabled()) {
|
||||
@@ -26,7 +26,7 @@ public class CPUTimeMeasurementTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Ignore("Use this to find out whether there is a significant penalty for CPU metering; it seems there isn't...")
|
||||
@Disabled("Use this to find out whether there is a significant penalty for CPU metering; it seems there isn't...")
|
||||
@Test
|
||||
public void measurePerformancePenalty() {
|
||||
final int AMOUNT_OF_WORK = 10_000_000;
|
||||
@@ -49,8 +49,8 @@ public class CPUTimeMeasurementTest {
|
||||
final long cpuTimeConsumedInMillis = cpuTimeConsumedInNanos / 1_000_000;
|
||||
final double factor = (double) Math.max(durationWithCpuTimeEnabledInMillis, cpuTimeConsumedInMillis) / (double) Math.min(durationWithCpuTimeEnabledInMillis, cpuTimeConsumedInMillis);
|
||||
logger.info("CPU time measured: "+cpuTimeConsumedInMillis+"ms; duration measured: "+durationWithCpuTimeEnabledInMillis+"ms; factor "+factor);
|
||||
assertTrue("off by more than factor "+FACTOR_THRESHOLD+" ("+factor+"): cpuTimeConsumed="+cpuTimeConsumedInMillis+"; actual duration: "+durationWithCpuTimeEnabledInMillis,
|
||||
(double) Math.max(durationWithCpuTimeEnabledInMillis, cpuTimeConsumedInMillis) / (double) Math.min(durationWithCpuTimeEnabledInMillis, cpuTimeConsumedInMillis) < FACTOR_THRESHOLD);
|
||||
assertTrue((double) Math.max(durationWithCpuTimeEnabledInMillis, cpuTimeConsumedInMillis) / (double) Math.min(durationWithCpuTimeEnabledInMillis, cpuTimeConsumedInMillis) < FACTOR_THRESHOLD,
|
||||
"off by more than factor "+FACTOR_THRESHOLD+" ("+factor+"): cpuTimeConsumed="+cpuTimeConsumedInMillis+"; actual duration: "+durationWithCpuTimeEnabledInMillis);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -92,8 +92,8 @@ public class CPUTimeMeasurementTest {
|
||||
// we assume that running each thread did take CPU time in the area of overall duration, with true parallelism
|
||||
final double factor = (double) Math.max(duration, averageCpuTimeMillis) / (double) Math.min(duration, averageCpuTimeMillis);
|
||||
logger.info("CPU time average: "+averageCpuTimeMillis+"ms; duration measured: "+duration+"ms; factor "+factor);
|
||||
assertTrue("off by more than factor "+FACTOR_THRESHOLD+" ("+factor+"): cpuTimeConsumed="+averageCpuTimeMillis+"; actual duration: "+duration,
|
||||
(double) Math.max(duration, averageCpuTimeMillis) / (double) Math.min(duration, averageCpuTimeMillis) < FACTOR_THRESHOLD);
|
||||
assertTrue((double) Math.max(duration, averageCpuTimeMillis) / (double) Math.min(duration, averageCpuTimeMillis) < FACTOR_THRESHOLD,
|
||||
"off by more than factor "+FACTOR_THRESHOLD+" ("+factor+"): cpuTimeConsumed="+averageCpuTimeMillis+"; actual duration: "+duration);
|
||||
}
|
||||
|
||||
private long useSingleCPUOnCurrentThread(int howMuch) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -10,7 +10,7 @@ import java.io.StringReader;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumMap;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sse.common.SortingOrder;
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.RecursiveTask;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Tests the concept of a {@link ForkJoinPool} by producing a deep hierarchy of {@link RecursiveTask}s
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
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.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -11,7 +11,7 @@ import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sse.util.ImageConverter;
|
||||
import com.sap.sse.util.ImageConverter.ImageWithMetadata;
|
||||
@@ -36,7 +36,7 @@ public class ImageConverterTest {
|
||||
/**
|
||||
* Setting up the testing environment
|
||||
*/
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
converter = new ImageConverter();
|
||||
pngImage = converter.loadImage(new ByteArrayInputStream(onePixelPngExample), "png");
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
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.sse.util.JvmUtils;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -9,8 +9,8 @@ import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sse.concurrent.LockUtil;
|
||||
import com.sap.sse.concurrent.NamedReentrantReadWriteLock;
|
||||
@@ -26,7 +26,7 @@ import com.sap.sse.concurrent.NamedReentrantReadWriteLock;
|
||||
public class LockSerializationTest {
|
||||
private NamedReentrantReadWriteLock lock;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
lock = new NamedReentrantReadWriteLock("A", /* fair */ false);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class RegexTest {
|
||||
private static final Logger logger = Logger.getLogger(RegexTest.class.getName());
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class SubstringTest {
|
||||
@Test
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
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.sse.util.IPAddressUtil;
|
||||
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sse.util.ThreadPoolUtil;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
@@ -8,9 +8,9 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.rules.Timeout;
|
||||
|
||||
import com.sap.sse.util.impl.ThreadFactoryWithPriority;
|
||||
@@ -31,7 +31,7 @@ public class ThreadPoolWithExceptionsTest {
|
||||
|
||||
private ThreadPoolExecutor executor;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
executor = new ThreadPoolExecutor(/* corePoolSize */ THREAD_POOL_SIZE,
|
||||
/* maximumPoolSize */ THREAD_POOL_SIZE,
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.sap.sse.test;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sse.util.ThreadPoolUtil;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
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.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
@@ -9,7 +9,7 @@ import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
@@ -58,8 +58,8 @@ public class TopologicalComparatorTest {
|
||||
public void testSimpleSortWithTrivialCycle() {
|
||||
addLessThan("A", "B"); addLessThan("B", "C"); addLessThan("C", "A");
|
||||
createGraph();
|
||||
assertEquals("Cycle not detected properly", 1, Util.size(graph.getCycleClusters().getClusters()));
|
||||
assertEquals("Cycle cluster not detected properly", 1, Util.size(graph.getCycleClusters().getClusters()));
|
||||
assertEquals(1, Util.size(graph.getCycleClusters().getClusters()), "Cycle not detected properly");
|
||||
assertEquals(1, Util.size(graph.getCycleClusters().getClusters()), "Cycle cluster not detected properly");
|
||||
TopologicalComparator<String> comparator = new TopologicalComparator<>(graph);
|
||||
assertMutualEquality(comparator, "A", "B", "C");
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class TopologicalComparatorTest {
|
||||
|
||||
private void assertOnCycle(String... nodes) {
|
||||
for (final String node : nodes) {
|
||||
assertTrue("Expected "+node+" on cycle but wasn't", StreamSupport.stream(graph.getCycleClusters().getClusters().spliterator(), /* parallel */ false).anyMatch(c->c.contains(node)));
|
||||
assertTrue(StreamSupport.stream(graph.getCycleClusters().getClusters().spliterator(), /* parallel */ false).anyMatch(c->c.contains(node)), "Expected "+node+" on cycle but wasn't");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,8 +144,8 @@ public class TopologicalComparatorTest {
|
||||
private void assertMutualEquality(TopologicalComparator<String> comparator, String... strings) {
|
||||
for (int i=0; i<strings.length; i++) {
|
||||
for (int j=0; j<strings.length; j++) {
|
||||
assertEquals(strings[i]+" at position "+i+" and "+strings[j]+" at position "+j+" compared incorrectly",
|
||||
0, comparator.compare(strings[i], strings[j]));
|
||||
assertEquals(0,
|
||||
comparator.compare(strings[i], strings[j]), strings[i]+" at position "+i+" and "+strings[j]+" at position "+j+" compared incorrectly");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,8 +153,8 @@ public class TopologicalComparatorTest {
|
||||
private void assertChain(TopologicalComparator<String> comparator, String... strings) {
|
||||
for (int i=0; i<strings.length; i++) {
|
||||
for (int j=0; j<strings.length; j++) {
|
||||
assertEquals(strings[i]+" at position "+i+" and "+strings[j]+" at position "+j+" compared incorrectly",
|
||||
Integer.compare(i, j), comparator.compare(strings[i], strings[j]));
|
||||
assertEquals(Integer.compare(i, j),
|
||||
comparator.compare(strings[i], strings[j]), strings[i]+" at position "+i+" and "+strings[j]+" at position "+j+" compared incorrectly");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class URLEncoderTest {
|
||||
@Test
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class VariableArityParameterNeverNullTest {
|
||||
@Test
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package com.sap.sse.test.jsonsimple;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* We face a strange issue with JSON String literals that represent file names coming from an iPhone
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.sap.sse.test.nio;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
@@ -14,7 +14,7 @@ import java.nio.channels.CompletionHandler;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class TestReadingFromAsynchronousServerSocket {
|
||||
@Test
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.sap.sse.test.zxcvbn;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.nulabinc.zxcvbn.StandardDictionaries;
|
||||
import com.nulabinc.zxcvbn.StandardKeyboards;
|
||||
@@ -39,14 +39,14 @@ public class GermanKeyboardTest {
|
||||
{
|
||||
final double defaultGuessesForQuertz = zxcvbn.measure(DE_PASSWD1).getGuesses();
|
||||
final double germanGuessesForQuertz = zxcvbnWithGermanKeyboard.measure(DE_PASSWD1).getGuesses();
|
||||
assertTrue(""+defaultGuessesForQuertz+" is not greater than "+germanGuessesForQuertz+" but should have been",
|
||||
defaultGuessesForQuertz > germanGuessesForQuertz);
|
||||
assertTrue(defaultGuessesForQuertz > germanGuessesForQuertz,
|
||||
""+defaultGuessesForQuertz+" is not greater than "+germanGuessesForQuertz+" but should have been");
|
||||
}
|
||||
{
|
||||
final double defaultGuessesForQuertz = zxcvbn.measure(DE_PASSWD2).getGuesses();
|
||||
final double germanGuessesForQuertz = zxcvbnWithGermanKeyboard.measure(DE_PASSWD2).getGuesses();
|
||||
assertTrue(""+defaultGuessesForQuertz+" is not greater than "+germanGuessesForQuertz+" but should have been",
|
||||
defaultGuessesForQuertz > germanGuessesForQuertz);
|
||||
assertTrue(defaultGuessesForQuertz > germanGuessesForQuertz,
|
||||
""+defaultGuessesForQuertz+" is not greater than "+germanGuessesForQuertz+" but should have been");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.sap.sse.util.apachelog;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ApacheLogAnalysisTest {
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user