diff --git a/pom.xml b/pom.xml
index 98d0e56f5..3dd7ebbbf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,8 +80,14 @@
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
test
diff --git a/src/main/java/net/openhft/chronicle/values/EnumFieldModel.java b/src/main/java/net/openhft/chronicle/values/EnumFieldModel.java
index 9f1060034..ad3bb0f36 100644
--- a/src/main/java/net/openhft/chronicle/values/EnumFieldModel.java
+++ b/src/main/java/net/openhft/chronicle/values/EnumFieldModel.java
@@ -6,7 +6,6 @@
import com.squareup.javapoet.ArrayTypeName;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
-import net.openhft.chronicle.core.Jvm;
import java.lang.reflect.Method;
diff --git a/src/main/java/net/openhft/chronicle/values/MyJavaFileManager.java b/src/main/java/net/openhft/chronicle/values/MyJavaFileManager.java
index 20bd92f6c..20f9acbf7 100644
--- a/src/main/java/net/openhft/chronicle/values/MyJavaFileManager.java
+++ b/src/main/java/net/openhft/chronicle/values/MyJavaFileManager.java
@@ -151,5 +151,4 @@ public String inferBinaryName(Location location, JavaFileObject file) {
}
return super.inferBinaryName(location, file);
}
-
}
diff --git a/src/test/java/net/openhft/chronicle/values/AlignTest.java b/src/test/java/net/openhft/chronicle/values/AlignTest.java
index d6dceb460..0997bf5ae 100644
--- a/src/test/java/net/openhft/chronicle/values/AlignTest.java
+++ b/src/test/java/net/openhft/chronicle/values/AlignTest.java
@@ -5,7 +5,7 @@
import net.openhft.chronicle.bytes.Byteable;
import net.openhft.chronicle.bytes.BytesStore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static net.openhft.chronicle.values.Values.newNativeReference;
@@ -18,8 +18,8 @@
* correctly.
*/
public class AlignTest extends ValuesTestCommon {
- @SuppressWarnings("unchecked")
@Test
+ @SuppressWarnings("unchecked")
public void testAlign() {
DemoOrderVOInterface value = newNativeReference(DemoOrderVOInterface.class);
long size = value.maxSize();
diff --git a/src/test/java/net/openhft/chronicle/values/ComplexValueTest.java b/src/test/java/net/openhft/chronicle/values/ComplexValueTest.java
index 3b93d1baf..5076142b5 100644
--- a/src/test/java/net/openhft/chronicle/values/ComplexValueTest.java
+++ b/src/test/java/net/openhft/chronicle/values/ComplexValueTest.java
@@ -5,7 +5,7 @@
import net.openhft.chronicle.bytes.Byteable;
import net.openhft.chronicle.bytes.BytesStore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Map;
import java.util.function.Function;
@@ -13,7 +13,7 @@
import static net.openhft.chronicle.values.Values.newHeapInstance;
import static net.openhft.chronicle.values.Values.newNativeReference;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
public class ComplexValueTest extends ValuesTestCommon {
@@ -44,13 +44,11 @@ public void heapAndNativeBehaviourMatch() {
Map byName = model.fields()
.collect(Collectors.toMap(FieldModel::name, Function.identity()));
- assertTrue("label field present", byName.containsKey("label"));
- assertTrue("mirrorEnabled field present", byName.containsKey("mirrorEnabled"));
- assertTrue("label offset should be resolved",
- model.fieldBitOffset(byName.get("label")) >= 0);
- assertTrue("history should allocate extent per element",
- model.fieldBitExtent(byName.get("history"))
- >= 3 * Long.SIZE);
+ assertTrue(byName.containsKey("label"), "label field present");
+ assertTrue(byName.containsKey("mirrorEnabled"), "mirrorEnabled field present");
+ assertTrue(model.fieldBitOffset(byName.get("label")) >= 0, "label offset should be resolved");
+ assertTrue(model.fieldBitExtent(byName.get("history")) >= 3 * Long.SIZE,
+ "history should allocate extent per element");
// behaviour assertions
assertEquals(ComplexValue.Status.ACTIVE, nativeValue.getStatus());
diff --git a/src/test/java/net/openhft/chronicle/values/CoreValuesTest.java b/src/test/java/net/openhft/chronicle/values/CoreValuesTest.java
index 722f1c7b1..82d2568b1 100644
--- a/src/test/java/net/openhft/chronicle/values/CoreValuesTest.java
+++ b/src/test/java/net/openhft/chronicle/values/CoreValuesTest.java
@@ -7,10 +7,10 @@
import net.openhft.chronicle.bytes.BytesStore;
import net.openhft.chronicle.core.values.*;
import org.jetbrains.annotations.NotNull;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static net.openhft.chronicle.bytes.BytesStore.nativeStoreWithFixedCapacity;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
@SuppressWarnings({"rawtypes", "unchecked"})
public class CoreValuesTest extends ValuesTestCommon {
diff --git a/src/test/java/net/openhft/chronicle/values/FirstPrimitiveFieldTest.java b/src/test/java/net/openhft/chronicle/values/FirstPrimitiveFieldTest.java
index f4344d9f4..09ec6911c 100644
--- a/src/test/java/net/openhft/chronicle/values/FirstPrimitiveFieldTest.java
+++ b/src/test/java/net/openhft/chronicle/values/FirstPrimitiveFieldTest.java
@@ -5,9 +5,9 @@
import net.openhft.chronicle.core.values.IntValue;
import net.openhft.chronicle.core.values.LongValue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Interface holding a five element array of {@code long} values for field type tests.
@@ -58,16 +58,24 @@ interface FiveBooleanValues {
* generated proxy.
*/
interface FiveLongAndBooleanValues {
- /** Returns the long array view. */
+ /**
+ * Returns the long array view.
+ */
FiveLongValues getLongValues();
- /** Assigns the long array view. */
+ /**
+ * Assigns the long array view.
+ */
void setLongValues(FiveLongValues values);
- /** Returns the boolean array view. */
+ /**
+ * Returns the boolean array view.
+ */
FiveBooleanValues getBooleanValues();
- /** Assigns the boolean array view. */
+ /**
+ * Assigns the boolean array view.
+ */
void setBooleanValues(FiveBooleanValues values);
}
@@ -79,16 +87,12 @@ public class FirstPrimitiveFieldTest extends ValuesTestCommon {
@Test
public void firstPrimitiveFieldTest() {
- assertEquals(int.class, ValueModel.acquire(IntValue.class).firstPrimitiveFieldType());
- assertEquals(long.class, ValueModel.acquire(LongValue.class).firstPrimitiveFieldType());
- assertEquals(long.class,
- ValueModel.acquire(Values.nativeClassFor(LongValue.class))
- .firstPrimitiveFieldType());
- assertEquals(long.class,
- ValueModel.acquire(FiveLongValues.class).firstPrimitiveFieldType());
- assertEquals(boolean.class,
- ValueModel.acquire(FiveBooleanValues.class).firstPrimitiveFieldType());
- assertEquals(long.class,
- ValueModel.acquire(FiveLongAndBooleanValues.class).firstPrimitiveFieldType());
+ assertSame(int.class, ValueModel.acquire(IntValue.class).firstPrimitiveFieldType());
+ assertSame(long.class, ValueModel.acquire(LongValue.class).firstPrimitiveFieldType());
+ assertSame(long.class, ValueModel.acquire(Values.nativeClassFor(LongValue.class))
+ .firstPrimitiveFieldType());
+ assertSame(long.class, ValueModel.acquire(FiveLongValues.class).firstPrimitiveFieldType());
+ assertSame(boolean.class, ValueModel.acquire(FiveBooleanValues.class).firstPrimitiveFieldType());
+ assertSame(long.class, ValueModel.acquire(FiveLongAndBooleanValues.class).firstPrimitiveFieldType());
}
}
diff --git a/src/test/java/net/openhft/chronicle/values/UnderscoreFieldNameTest.java b/src/test/java/net/openhft/chronicle/values/UnderscoreFieldNameTest.java
index 822a304f9..5fc0d5bf1 100644
--- a/src/test/java/net/openhft/chronicle/values/UnderscoreFieldNameTest.java
+++ b/src/test/java/net/openhft/chronicle/values/UnderscoreFieldNameTest.java
@@ -3,7 +3,7 @@
*/
package net.openhft.chronicle.values;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class UnderscoreFieldNameTest extends ValuesTestCommon {
diff --git a/src/test/java/net/openhft/chronicle/values/ValueGeneratorTest.java b/src/test/java/net/openhft/chronicle/values/ValueGeneratorTest.java
index 0e753821a..bda35849d 100644
--- a/src/test/java/net/openhft/chronicle/values/ValueGeneratorTest.java
+++ b/src/test/java/net/openhft/chronicle/values/ValueGeneratorTest.java
@@ -7,7 +7,7 @@
import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.bytes.BytesStore;
import net.openhft.chronicle.core.values.LongValue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.lang.reflect.InvocationTargetException;
import java.nio.ByteBuffer;
@@ -17,7 +17,7 @@
import static net.openhft.chronicle.values.Generators.generateNativeClass;
import static net.openhft.chronicle.values.Values.newHeapInstance;
import static net.openhft.chronicle.values.Values.newNativeReference;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import static net.openhft.compiler.CompilerUtils.CACHED_COMPILER;
/**
@@ -87,8 +87,8 @@ public void testGenerateJavaCode2() {
assertTrue(mi2.flag());
}
- @SuppressWarnings("rawtypes")
@Test
+ @SuppressWarnings("rawtypes")
public void testGenerateNativeWithGetUsing() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
String actual = generateNativeClass(ValueModel.acquire(JavaBeanInterfaceGetUsing.class),
ValueModel.simpleName(JavaBeanInterfaceGetUsing.class) + "$$Native");
diff --git a/src/test/java/net/openhft/chronicle/values/ValueInterfaceWithEnumTest.java b/src/test/java/net/openhft/chronicle/values/ValueInterfaceWithEnumTest.java
index cfe84648a..1e2e309f7 100644
--- a/src/test/java/net/openhft/chronicle/values/ValueInterfaceWithEnumTest.java
+++ b/src/test/java/net/openhft/chronicle/values/ValueInterfaceWithEnumTest.java
@@ -5,10 +5,10 @@
import net.openhft.chronicle.bytes.Byteable;
import net.openhft.chronicle.bytes.BytesStore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static net.openhft.chronicle.values.ValueInterfaceWithEnumTest.SimpleValueInterface.SVIEnum.SIX;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author ges
@@ -20,8 +20,8 @@ public class ValueInterfaceWithEnumTest extends ValuesTestCommon {
* This test will throw an {@link ArrayIndexOutOfBoundsException}. This seems to occur only with Enums having even number of
* values
*/
- @SuppressWarnings({"rawtypes", "unchecked"})
@Test
+ @SuppressWarnings({"rawtypes", "unchecked"})
public void testValueInterface() {
SimpleValueInterface nativeValue = Values.newNativeReference(SimpleValueInterface.class);
int modelSize = ValueModel.acquire(SimpleValueInterface.class).sizeInBytes();
@@ -35,7 +35,7 @@ public void testValueInterface() {
heapValue.copyFrom(nativeValue);
assertEquals(1, heapValue.getId());
- assertEquals(true, heapValue.getTruth());
+ assertTrue(heapValue.getTruth());
assertEquals(SIX, heapValue.getSVIEnum());
heapValue.setId(2);
@@ -45,7 +45,7 @@ public void testValueInterface() {
nativeValue.copyFrom(heapValue);
assertEquals(2, nativeValue.getId());
- assertEquals(false, nativeValue.getTruth());
+ assertFalse(nativeValue.getTruth());
assertEquals(null, nativeValue.getSVIEnum());
}
diff --git a/src/test/java/net/openhft/chronicle/values/ValuesTestCommon.java b/src/test/java/net/openhft/chronicle/values/ValuesTestCommon.java
index 599acbc3f..dca96263f 100644
--- a/src/test/java/net/openhft/chronicle/values/ValuesTestCommon.java
+++ b/src/test/java/net/openhft/chronicle/values/ValuesTestCommon.java
@@ -11,8 +11,8 @@
import net.openhft.chronicle.core.threads.CleaningThread;
import net.openhft.chronicle.core.threads.ThreadDump;
import net.openhft.chronicle.core.time.SystemTimeProvider;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -32,7 +32,13 @@ public class ValuesTestCommon {
private Map exceptions;
private final Map, String> expectedExceptions = new LinkedHashMap<>();
- @Before
+ @BeforeEach
+ public void beforeEachValuesTestCommon() {
+ enableReferenceTracing();
+ threadDump();
+ recordExceptions();
+ }
+
public void enableReferenceTracing() {
AbstractReferenceCounted.enableReferenceTracing();
}
@@ -45,7 +51,6 @@ private void assertReferencesReleased() {
AbstractReferenceCounted.assertReferencesReleased();
}
- @Before
public void threadDump() {
threadDump = new ThreadDump();
}
@@ -54,7 +59,6 @@ private void checkThreadDump() {
threadDump.assertNoNewThreads();
}
- @Before
public void recordExceptions() {
exceptions = Jvm.recordExceptions();
}
@@ -98,7 +102,7 @@ private void checkExceptions() {
}
}
- @After
+ @AfterEach
public void afterChecks() {
SystemTimeProvider.CLOCK = SystemTimeProvider.INSTANCE;
CleaningThread.performCleanup(Thread.currentThread());
diff --git a/src/test/java/net/openhft/chronicle/values/VolatileTest.java b/src/test/java/net/openhft/chronicle/values/VolatileTest.java
index 6640fee5b..ce024c9aa 100644
--- a/src/test/java/net/openhft/chronicle/values/VolatileTest.java
+++ b/src/test/java/net/openhft/chronicle/values/VolatileTest.java
@@ -5,33 +5,32 @@
import net.openhft.chronicle.bytes.Byteable;
import net.openhft.chronicle.bytes.BytesStore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.ByteBuffer;
import static net.openhft.chronicle.values.Values.newHeapInstance;
import static net.openhft.chronicle.values.Values.newNativeReference;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.*;
/*
* Created by daniel on 11/06/2014.
*/
public class VolatileTest extends ValuesTestCommon {
- @SuppressWarnings({"rawtypes", "unchecked"})
@Test
+ @SuppressWarnings({"rawtypes", "unchecked"})
public void testGenerateJavaCode() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
/* try{
BadInterface1 jbi = dvg.heapInstance(BadInterface1.class);
- assertFalse("Should have thrown an IllegalArgumentException", true);
+ assertFalse(true, "Should have thrown an IllegalArgumentException");
}catch(AssertionError e){
assertTrue("Throws an IllegalArgumentException", true);
}
try{
BadInterface2 jbi = dvg.heapInstance(BadInterface2.class);
- assertFalse("Should have thrown an IllegalArgumentException", true);
+ assertFalse(true, "Should have thrown an IllegalArgumentException");
}catch(AssertionError e){
assertTrue("Throws an IllegalArgumentException", true);
}
@@ -53,7 +52,7 @@ public void testGenerateJavaCode() throws ClassNotFoundException, IllegalAccessE
assertEquals(3, jbi.getVolatileIntAt(3));
} catch (AssertionError e) {
e.printStackTrace();
- assertFalse("Throws an IllegalArgumentException", true);
+ assertFalse(true, "Throws an IllegalArgumentException");
}
//Test the native interface
@@ -75,7 +74,7 @@ public void testGenerateJavaCode() throws ClassNotFoundException, IllegalAccessE
assertEquals(3, jbi.getVolatileIntAt(3));
} catch (AssertionError e) {
e.printStackTrace();
- assertFalse("Throws an IllegalArgumentException", true);
+ assertFalse(true, "Throws an IllegalArgumentException");
}
}
diff --git a/src/test/java/net/openhft/chronicle/values/issue10/ChronicleValueTypeTest.java b/src/test/java/net/openhft/chronicle/values/issue10/ChronicleValueTypeTest.java
index 1e84b47f6..4b0392111 100644
--- a/src/test/java/net/openhft/chronicle/values/issue10/ChronicleValueTypeTest.java
+++ b/src/test/java/net/openhft/chronicle/values/issue10/ChronicleValueTypeTest.java
@@ -5,7 +5,7 @@
import net.openhft.chronicle.values.Values;
import net.openhft.chronicle.values.ValuesTestCommon;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ChronicleValueTypeTest extends ValuesTestCommon {
diff --git a/src/test/java/net/openhft/chronicle/values/issue9/HeapVsNativeTest.java b/src/test/java/net/openhft/chronicle/values/issue9/HeapVsNativeTest.java
index 4d2033759..9db8fbc72 100644
--- a/src/test/java/net/openhft/chronicle/values/issue9/HeapVsNativeTest.java
+++ b/src/test/java/net/openhft/chronicle/values/issue9/HeapVsNativeTest.java
@@ -9,10 +9,9 @@
import net.openhft.chronicle.values.NotNull;
import net.openhft.chronicle.values.Values;
import net.openhft.chronicle.values.ValuesTestCommon;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Tests that heap and native {@link Entity} values hold the same content but
@@ -33,8 +32,8 @@ public void heap() {
/**
* Exercises a native reference and checks it behaves like the heap variant.
*/
- @SuppressWarnings({"rawtypes", "unchecked"})
@Test
+ @SuppressWarnings({"rawtypes", "unchecked"})
public void nativeRef() {
Entity entity = Values.newNativeReference(Entity.class);
byte[] bytes = new byte[7];
diff --git a/src/test/java/net/openhft/chronicle/values/pointer/PointerTest.java b/src/test/java/net/openhft/chronicle/values/pointer/PointerTest.java
index 796d574d3..6bac8975c 100644
--- a/src/test/java/net/openhft/chronicle/values/pointer/PointerTest.java
+++ b/src/test/java/net/openhft/chronicle/values/pointer/PointerTest.java
@@ -8,10 +8,10 @@
import net.openhft.chronicle.values.Values;
import net.openhft.chronicle.values.ValuesTestCommon;
import org.jetbrains.annotations.NotNull;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static java.util.Objects.requireNonNull;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
public class PointerTest extends ValuesTestCommon {