aboutsummaryrefslogtreecommitdiffstats
path: root/vespaclient-java/src/test/java/com/yahoo/vespastat/CommandLineOptionsTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'vespaclient-java/src/test/java/com/yahoo/vespastat/CommandLineOptionsTest.java')
-rw-r--r--vespaclient-java/src/test/java/com/yahoo/vespastat/CommandLineOptionsTest.java36
1 files changed, 20 insertions, 16 deletions
diff --git a/vespaclient-java/src/test/java/com/yahoo/vespastat/CommandLineOptionsTest.java b/vespaclient-java/src/test/java/com/yahoo/vespastat/CommandLineOptionsTest.java
index 4bfe9b68b65..b030120ac52 100644
--- a/vespaclient-java/src/test/java/com/yahoo/vespastat/CommandLineOptionsTest.java
+++ b/vespaclient-java/src/test/java/com/yahoo/vespastat/CommandLineOptionsTest.java
@@ -1,12 +1,12 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespastat;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
public class CommandLineOptionsTest {
@@ -16,12 +16,12 @@ public class CommandLineOptionsTest {
}
@Test
- public void testHelp() {
+ void testHelp() {
assertTrue(getParsedOptions("--help").help);
}
@Test
- public void testMultipleOptions() {
+ void testMultipleOptions() {
ClientParameters params = getParsedOptions("--dump", "--route", "dummyroute", "--user", "userid");
assertTrue(params.dumpData);
assertEquals("dummyroute", params.route);
@@ -30,7 +30,7 @@ public class CommandLineOptionsTest {
}
@Test
- public void testSelectionTypes() {
+ void testSelectionTypes() {
assertEquals(ClientParameters.SelectionType.USER, getParsedOptions("--user", "id").selectionType);
assertEquals(ClientParameters.SelectionType.DOCUMENT, getParsedOptions("--document", "id").selectionType);
assertEquals(ClientParameters.SelectionType.BUCKET, getParsedOptions("--bucket", "id").selectionType);
@@ -38,24 +38,28 @@ public class CommandLineOptionsTest {
assertEquals(ClientParameters.SelectionType.GID, getParsedOptions("--gid", "id").selectionType);
}
- @Test(expected = IllegalArgumentException.class)
- public void testMissingSelectionType() {
- getParsedOptions();
+ @Test
+ void testMissingSelectionType() {
+ assertThrows(IllegalArgumentException.class, () -> {
+ getParsedOptions();
+ });
}
- @Test(expected = IllegalArgumentException.class)
- public void testFailOnMultipleDumpTypes() {
- getParsedOptions("--user", "id", "--document", "id", "--group", "id", "--gid", "id");
+ @Test
+ void testFailOnMultipleDumpTypes() {
+ assertThrows(IllegalArgumentException.class, () -> {
+ getParsedOptions("--user", "id", "--document", "id", "--group", "id", "--gid", "id");
+ });
}
@Test
- public void testForceDumpOnDocumentOrGid() {
+ void testForceDumpOnDocumentOrGid() {
assertTrue(getParsedOptions("--document", "docid").dumpData);
assertTrue(getParsedOptions("--gid", "gid").dumpData);
}
@Test
- public void testPrintHelp() {
+ void testPrintHelp() {
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
PrintStream oldOut = System.out;
System.setOut(new PrintStream(outContent));
@@ -71,17 +75,17 @@ public class CommandLineOptionsTest {
}
@Test
- public void bucket_space_is_default_unless_specified() {
+ void bucket_space_is_default_unless_specified() {
assertEquals("default", getParsedOptions("--user", "id").bucketSpace);
}
@Test
- public void can_specify_explicit_bucket_space() {
+ void can_specify_explicit_bucket_space() {
assertEquals("global", getParsedOptions("--user", "id", "--bucketspace", "global").bucketSpace);
}
@Test
- public void testDefaultRoute() {
+ void testDefaultRoute() {
assertEquals("default", getParsedOptions("--user", "dummyuser").route);
}