summaryrefslogtreecommitdiffstats
path: root/hosted-api
diff options
context:
space:
mode:
authorJon Marius Venstad <jvenstad@yahoo-inc.com>2019-06-21 16:06:32 +0200
committerJon Marius Venstad <jvenstad@yahoo-inc.com>2019-06-21 16:06:32 +0200
commit7b913e0cd410920aac6ebfc5b4031a32e4a9befc (patch)
treebe3eb4b4742c6da2ad2c1cbe25179c686dd24cad /hosted-api
parenta0d854b6a3fab6fe44b1164c071fc994b331c3bc (diff)
Surefire 2.22 and junit5 dependency management, with POC
Diffstat (limited to 'hosted-api')
-rw-r--r--hosted-api/pom.xml10
-rw-r--r--hosted-api/src/test/java/ai/vespa/hosted/api/MultiPartStreamerTest.java16
-rw-r--r--hosted-api/src/test/java/ai/vespa/hosted/api/SignaturesTest.java14
3 files changed, 20 insertions, 20 deletions
diff --git a/hosted-api/pom.xml b/hosted-api/pom.xml
index f20244a8816..928a173f9d8 100644
--- a/hosted-api/pom.xml
+++ b/hosted-api/pom.xml
@@ -34,9 +34,13 @@
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/hosted-api/src/test/java/ai/vespa/hosted/api/MultiPartStreamerTest.java b/hosted-api/src/test/java/ai/vespa/hosted/api/MultiPartStreamerTest.java
index a55c0d91cd3..bfc544e82f8 100644
--- a/hosted-api/src/test/java/ai/vespa/hosted/api/MultiPartStreamerTest.java
+++ b/hosted-api/src/test/java/ai/vespa/hosted/api/MultiPartStreamerTest.java
@@ -1,9 +1,8 @@
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.hosted.api;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import java.io.IOException;
import java.net.URI;
@@ -12,16 +11,13 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-public class MultiPartStreamerTest {
-
- @Rule
- public TemporaryFolder tmp = new TemporaryFolder();
+class MultiPartStreamerTest {
@Test
- public void test() throws IOException {
- Path file = tmp.newFile().toPath();
+ void test(@TempDir Path tmp) throws IOException {
+ Path file = tmp.resolve("file");
Files.write(file, new byte[]{0x48, 0x69});
MultiPartStreamer streamer = new MultiPartStreamer("My boundary");
diff --git a/hosted-api/src/test/java/ai/vespa/hosted/api/SignaturesTest.java b/hosted-api/src/test/java/ai/vespa/hosted/api/SignaturesTest.java
index 0a0d4a48edf..6749fb902f9 100644
--- a/hosted-api/src/test/java/ai/vespa/hosted/api/SignaturesTest.java
+++ b/hosted-api/src/test/java/ai/vespa/hosted/api/SignaturesTest.java
@@ -1,7 +1,7 @@
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.hosted.api;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@@ -16,9 +16,9 @@ import java.time.ZoneOffset;
import static ai.vespa.hosted.api.Signatures.sha256Digest;
import static ai.vespa.hosted.api.Signatures.sha256Digester;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests that messages can be signed and verified, and that the keys used for this can be parsed.
@@ -32,7 +32,7 @@ import static org.junit.Assert.assertTrue;
*
* @author jonmv
*/
-public class SignaturesTest {
+class SignaturesTest {
private static final String ecPemPublicKey = "-----BEGIN PUBLIC KEY-----\n" +
"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuKVFA8dXk43kVfYKzkUqhEY2rDT9\n" +
@@ -58,7 +58,7 @@ public class SignaturesTest {
"∠( ᐛ 」∠)_").getBytes(UTF_8);
@Test
- public void testHashing() throws Exception {
+ void testHashing() throws Exception {
byte[] hash1 = MessageDigest.getInstance("SHA-256").digest(message);
byte[] hash2 = sha256Digest(() -> new ByteArrayInputStream(message));
DigestInputStream digester = sha256Digester(new ByteArrayInputStream(message));
@@ -70,7 +70,7 @@ public class SignaturesTest {
}
@Test
- public void testSigning() {
+ void testSigning() {
Clock clock = Clock.fixed(Instant.EPOCH, ZoneOffset.UTC);
RequestSigner signer = new RequestSigner(ecPemPrivateKey, "myKey", clock);