Merge pull request #334 from XN137/remove-junit4-dependency

Remove junit4 dependency
This commit is contained in:
Jonathan Shook
2021-06-17 09:54:49 -05:00
committed by GitHub
225 changed files with 479 additions and 469 deletions

View File

@@ -1,10 +1,11 @@
package io.nosqlbench.engine.cli;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public class BasicScriptBufferTest {
@@ -62,14 +63,9 @@ public class BasicScriptBufferTest {
assertThat(script).matches("(?s).*a single line.*");
}
@Test(expected = NumberFormatException.class)
@Test
public void shouldThrowErrorForInvalidWaitMillisOperand() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "waitmillis", "noway" });
BasicScriptBuffer b = new BasicScriptBuffer();
b.add(opts.getCommands().toArray(new Cmd[0]));
String s = b.getParsedScript();
assertThatExceptionOfType(NumberFormatException.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{ "waitmillis", "noway" }));
}
}

View File

@@ -1,6 +1,6 @@
package io.nosqlbench.engine.cli;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.LinkedList;
import java.util.List;

View File

@@ -1,6 +1,6 @@
package io.nosqlbench.engine.cli;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.file.Files;
@@ -10,6 +10,7 @@ import java.util.LinkedList;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public class NBCLIArgsFileTest {
@@ -30,11 +31,11 @@ public class NBCLIArgsFileTest {
System.out.println(result);
}
@Test(expected = RuntimeException.class)
@Test
public void testLoadingMissingRequiredFails() {
LinkedList<String> result;
NBCLIArgsFile argsFile = new NBCLIArgsFile();
result = argsFile.process("--argsfile-required", "src/test/resources/argsfiles/nonextant.cli");
assertThatExceptionOfType(RuntimeException.class)
.isThrownBy(() -> argsFile.process("--argsfile-required", "src/test/resources/argsfiles/nonextant.cli"));
}
@Test

View File

@@ -2,11 +2,12 @@ package io.nosqlbench.engine.cli;
import io.nosqlbench.engine.api.scenarios.NBCLIScenarioParser;
import io.nosqlbench.nb.api.errors.BasicError;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public class NBCLIScenarioParserTest {
@@ -49,15 +50,16 @@ public class NBCLIScenarioParserTest {
assertThat(cmds.get(0).getArg("driver")).isEqualTo("stdout");
}
@Test(expected = BasicError.class)
@Test
public void testThatVerboseFinalParameterThrowsError() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "scenario-test", "yaml=canttouchthis"});
List<Cmd> cmds = opts.getCommands();
assertThatExceptionOfType(BasicError.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{ "scenario-test", "yaml=canttouchthis"}));
}
@Test(expected = BasicError.class)
@Test
public void testThatMissingScenarioNameThrowsError() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "scenario-test", "missing-scenario"});
assertThatExceptionOfType(BasicError.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{ "scenario-test", "missing-scenario"}));
}
@Test

View File

@@ -17,7 +17,7 @@
package io.nosqlbench.engine.cli;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -2,7 +2,7 @@ package io.nosqlbench.engine.cli;
import io.nosqlbench.docsys.core.PathWalker;
import io.nosqlbench.nb.api.content.NBIO;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.net.URL;
import java.nio.file.Path;
@@ -11,6 +11,7 @@ import java.util.List;
import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public class TestNBCLIOptions {
@@ -87,9 +88,10 @@ public class TestNBCLIOptions {
assertThat(opts.wantsTopicalHelp()).isFalse();
}
@Test(expected = IllegalArgumentException.class)
@Test
public void shouldErrorSanelyWhenNoMatch() {
NBCLIOptions opts = new NBCLIOptions(new String[]{"unrecognizable command"});
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{"unrecognizable command"}));
}
@Test
@@ -102,14 +104,16 @@ public class TestNBCLIOptions {
assertThat(cmd.getParams().get("param1")).isEqualTo("value1");
}
@Test(expected = InvalidParameterException.class)
@Test
public void testShouldErrorSanelyWhenScriptNameSkipped() {
NBCLIOptions opts = new NBCLIOptions(new String[]{"script", "param1=value1"});
assertThatExceptionOfType(InvalidParameterException.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{"script", "param1=value1"}));
}
@Test(expected = InvalidParameterException.class)
@Test
public void testShouldErrorForMissingScriptName() {
NBCLIOptions opts = new NBCLIOptions(new String[]{"script"});
assertThatExceptionOfType(InvalidParameterException.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{"script"}));
}
@Test
@@ -140,10 +144,10 @@ public class TestNBCLIOptions {
}
@Test(expected = InvalidParameterException.class)
@Test
public void shouldThrowErrorForInvalidStopActivity() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "stop", "woah=woah" });
List<Cmd> cmds = opts.getCommands();
assertThatExceptionOfType(InvalidParameterException.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{ "stop", "woah=woah" }));
}
@Test
@@ -155,11 +159,10 @@ public class TestNBCLIOptions {
}
@Test(expected = InvalidParameterException.class)
@Test
public void shouldThrowErrorForInvalidAwaitActivity() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "await", "awaitme=notvalid" });
List<Cmd> cmds = opts.getCommands();
assertThatExceptionOfType(InvalidParameterException.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{ "await", "awaitme=notvalid" }));
}
@Test