diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index a9f1ef87..5d43cd33 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,2 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/graphwalker-cli/src/test/java/org/graphwalker/cli/CheckTest.java b/graphwalker-cli/src/test/java/org/graphwalker/cli/CheckTest.java index e815a6fb..91ddf664 100644 --- a/graphwalker-cli/src/test/java/org/graphwalker/cli/CheckTest.java +++ b/graphwalker-cli/src/test/java/org/graphwalker/cli/CheckTest.java @@ -26,11 +26,11 @@ package org.graphwalker.cli; -import org.junit.Assert; import org.junit.Test; import java.io.IOException; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.core.Is.is; @@ -41,15 +41,15 @@ public class CheckTest extends CLITestRoot { public void check() throws IOException { String args[] = {"check", "-m", "graphml/online/ShoppingCart.graphml", "random(edge_coverage(100))"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertThat(result.getOutput(), containsString("No issues found with the model(s).")); + assertThat(result.getError(), is("")); + assertThat(result.getOutput(), containsString("No issues found with the model(s).")); } @Test public void checkWithBlocked() throws IOException { String args[] = {"check", "-m", "graphml/online/ShoppingCart.graphml", "random(edge_coverage(100))"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertThat(result.getOutput(), containsString("No issues found with the model(s).")); + assertThat(result.getError(), is("")); + assertThat(result.getOutput(), containsString("No issues found with the model(s).")); } } diff --git a/graphwalker-cli/src/test/java/org/graphwalker/cli/ConvertFilesTest.java b/graphwalker-cli/src/test/java/org/graphwalker/cli/ConvertFilesTest.java index 0c9c92ab..e32f852a 100644 --- a/graphwalker-cli/src/test/java/org/graphwalker/cli/ConvertFilesTest.java +++ b/graphwalker-cli/src/test/java/org/graphwalker/cli/ConvertFilesTest.java @@ -26,11 +26,11 @@ package org.graphwalker.cli; -import org.junit.Assert; import org.junit.Test; import java.io.IOException; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; @@ -46,7 +46,7 @@ public class ConvertFilesTest extends CLITestRoot { public void convertGraphmlToJava() throws IOException { String args[] = {"convert", "--input", "graphml/UC01_GW2.graphml", "--format", "java"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); + assertThat(result.getError(), is("")); //TODO:Fix test // Assert.assertTrue(tempFile.length() > 0); } diff --git a/graphwalker-cli/src/test/java/org/graphwalker/cli/CorrectModelsTest.java b/graphwalker-cli/src/test/java/org/graphwalker/cli/CorrectModelsTest.java index f8ee1a7b..3071ffc5 100644 --- a/graphwalker-cli/src/test/java/org/graphwalker/cli/CorrectModelsTest.java +++ b/graphwalker-cli/src/test/java/org/graphwalker/cli/CorrectModelsTest.java @@ -48,11 +48,11 @@ package org.graphwalker.cli; -import org.junit.Assert; import org.junit.Test; import java.util.Arrays; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasItems; import static org.hamcrest.Matchers.not; import static org.hamcrest.core.Is.is; @@ -67,8 +67,8 @@ public class CorrectModelsTest extends CLITestRoot { public void simplestModel() { String args[] = {"offline", "-m", "graphml/CorrectModels/simplestModel.graphml", "random(vertex_coverage(100))"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertThat(result.getOutput(), is("{\"currentElementName\":\"e1\"}" + System.lineSeparator() + + assertThat(result.getError(), is("")); + assertThat(result.getOutput(), is("{\"currentElementName\":\"e1\"}" + System.lineSeparator() + "{\"currentElementName\":\"v1\"}" + System.lineSeparator())); } @@ -79,8 +79,8 @@ public void simplestModel() { public void shortestAllPathsVertexCoverage() { String args[] = {"offline", "-m", "graphml/CorrectModels/shortestAllPathsVertexCoverage.graphml", "shortest_all_paths(vertex_coverage(100))"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertThat(result.getOutput(), is("{\"currentElementName\":\"e1\"}" + System.lineSeparator() + + assertThat(result.getError(), is("")); + assertThat(result.getOutput(), is("{\"currentElementName\":\"e1\"}" + System.lineSeparator() + "{\"currentElementName\":\"v1\"}" + System.lineSeparator() + "{\"currentElementName\":\"e2\"}" + System.lineSeparator() + "{\"currentElementName\":\"v2\"}" + System.lineSeparator() + @@ -99,7 +99,7 @@ public void shortestAllPathsVertexCoverage() { public void loginNoErrors() { String args[] = {"offline", "-o", "-m", "graphml/Login.graphml", "random(edge_coverage(100))"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); + assertThat(result.getError(), is("")); } /** @@ -109,8 +109,8 @@ public void loginNoErrors() { public void noStartVertex() { String args[] = {"offline", "-e", "v1", "-m", "graphml/CorrectModels/modelWithNoStartVertex.graphml", "a_star(reached_edge(e4))"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertThat(result.getOutput(), is("{\"currentElementName\":\"v1\"}" + System.lineSeparator() + + assertThat(result.getError(), is("")); + assertThat(result.getOutput(), is("{\"currentElementName\":\"v1\"}" + System.lineSeparator() + "{\"currentElementName\":\"e2\"}" + System.lineSeparator() + "{\"currentElementName\":\"v2\"}" + System.lineSeparator() + "{\"currentElementName\":\"e4\"}" + System.lineSeparator())); @@ -123,8 +123,8 @@ public void noStartVertex() { public void dontUseBlocked() { String args[] = {"offline", "-b", "false", "-m", "graphml/CorrectModels/blockedVertex.graphml", "random(edge_coverage(100))"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertThat(result.getOutput(), is("{\"currentElementName\":\"e1\"}" + System.lineSeparator() + + assertThat(result.getError(), is("")); + assertThat(result.getOutput(), is("{\"currentElementName\":\"e1\"}" + System.lineSeparator() + "{\"currentElementName\":\"v1\"}" + System.lineSeparator() + "{\"currentElementName\":\"e2\"}" + System.lineSeparator() + "{\"currentElementName\":\"v2\"}" + System.lineSeparator())); @@ -137,8 +137,8 @@ public void dontUseBlocked() { public void useBlocked() { String args[] = {"offline", "-m", "graphml/CorrectModels/blockedVertex.graphml", "random(edge_coverage(100))"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertThat(result.getOutput(), is("{\"currentElementName\":\"e1\"}" + System.lineSeparator() + + assertThat(result.getError(), is("")); + assertThat(result.getOutput(), is("{\"currentElementName\":\"e1\"}" + System.lineSeparator() + "{\"currentElementName\":\"v1\"}" + System.lineSeparator())); } @@ -149,8 +149,8 @@ public void useBlocked() { public void dontUseBlockedJson() { String args[] = {"offline", "-b", "false", "-g", "json/graphWithBlockedElements.json"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertThat(Arrays.asList(result.getOutput().split(System.lineSeparator())), + assertThat(result.getError(), is("")); + assertThat(Arrays.asList(result.getOutput().split(System.lineSeparator())), hasItems("{\"currentElementName\":\"e1\"}", "{\"currentElementName\":\"e2\"}", "{\"currentElementName\":\"e3\"}", @@ -175,8 +175,8 @@ public void dontUseBlockedJson() { public void useBlockedJson() { String args[] = {"offline", "-g", "json/graphWithBlockedElements.json"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertThat(Arrays.asList(result.getOutput().split(System.lineSeparator())), + assertThat(result.getError(), is("")); + assertThat(Arrays.asList(result.getOutput().split(System.lineSeparator())), hasItems("{\"currentElementName\":\"e1\"}", "{\"currentElementName\":\"e2\"}", "{\"currentElementName\":\"e3\"}", @@ -189,7 +189,7 @@ public void useBlockedJson() { "{\"currentElementName\":\"v3\"}", "{\"currentElementName\":\"v4\"}")); - Assert.assertThat(Arrays.asList(result.getOutput().split(System.lineSeparator())), + assertThat(Arrays.asList(result.getOutput().split(System.lineSeparator())), not(hasItems("{\"currentElementName\":\"e5\"}", "{\"currentElementName\":\"e6\"}", "{\"currentElementName\":\"v5\"}"))); diff --git a/graphwalker-cli/src/test/java/org/graphwalker/cli/IOErrorsTest.java b/graphwalker-cli/src/test/java/org/graphwalker/cli/IOErrorsTest.java index f0d29ba0..5f6ef434 100644 --- a/graphwalker-cli/src/test/java/org/graphwalker/cli/IOErrorsTest.java +++ b/graphwalker-cli/src/test/java/org/graphwalker/cli/IOErrorsTest.java @@ -26,9 +26,9 @@ * #L% */ -import org.junit.Assert; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; @@ -41,9 +41,9 @@ public class IOErrorsTest extends CLITestRoot { public void nonExistentFile() { String args[] = {"offline", "-m", "sdsdtkdsjhsl.graphml", "random(edge_coverage(100))"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("An error occurred when running command: " + + assertThat(result.getError(), is("An error occurred when running command: " + "offline -m sdsdtkdsjhsl.graphml random(edge_coverage(100))" + System.lineSeparator() + "Could not read the file." + System.lineSeparator() + System.lineSeparator())); - Assert.assertThat(result.getOutput(), is("")); + assertThat(result.getOutput(), is("")); } } diff --git a/graphwalker-cli/src/test/java/org/graphwalker/cli/IncorrectModelsTest.java b/graphwalker-cli/src/test/java/org/graphwalker/cli/IncorrectModelsTest.java index 17897836..f9a43ea5 100644 --- a/graphwalker-cli/src/test/java/org/graphwalker/cli/IncorrectModelsTest.java +++ b/graphwalker-cli/src/test/java/org/graphwalker/cli/IncorrectModelsTest.java @@ -26,9 +26,9 @@ * #L% */ -import org.junit.Assert; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; @@ -41,14 +41,14 @@ public class IncorrectModelsTest extends CLITestRoot { public void wrongVertexSyntax() { String args[] = {"offline", "-m", "graphml/IncorrectModels/wrongVertexSyntax.graphml", "random(edge_coverage(100))"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), + assertThat(result.getError(), is("When parsing model: 'graphml/IncorrectModels/wrongVertexSyntax.graphml' The string '1' did not conform to GraphWalker syntax rules." + System.lineSeparator() + System.lineSeparator() + "An error occurred when running command: offline -m graphml/IncorrectModels/wrongVertexSyntax.graphml random(edge_coverage(100))" + System.lineSeparator() + "Model syntax error" + System.lineSeparator() + System.lineSeparator())); - Assert.assertThat(result.getOutput(), is("")); + assertThat(result.getOutput(), is("")); } /** @@ -58,10 +58,10 @@ public void wrongVertexSyntax() { public void onlyOneVertex() { String args[] = {"offline", "-m", "graphml/IncorrectModels/singleVertex.graphml", "random(edge_coverage(100))"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("An error occurred when running command: " + + assertThat(result.getError(), is("An error occurred when running command: " + "offline -m graphml/IncorrectModels/singleVertex.graphml random(edge_coverage(100))" + System.lineSeparator() + "No start context found" + System.lineSeparator() + System.lineSeparator())); - Assert.assertThat(result.getOutput(), is("")); + assertThat(result.getOutput(), is("")); } /** @@ -71,10 +71,10 @@ public void onlyOneVertex() { public void singleStartVertex() { String args[] = {"offline", "-m", "graphml/IncorrectModels/singleStartVertex.graphml", "random(edge_coverage(100))"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("An error occurred when running command: " + + assertThat(result.getError(), is("An error occurred when running command: " + "offline -m graphml/IncorrectModels/singleStartVertex.graphml random(edge_coverage(100))" + System.lineSeparator() + "No start context found" + System.lineSeparator() + System.lineSeparator())); - Assert.assertThat(result.getOutput(), is("")); + assertThat(result.getOutput(), is("")); } /** @@ -84,14 +84,14 @@ public void singleStartVertex() { public void badEdgeName() { String args[] = {"offline", "-m", "graphml/IncorrectModels/badEdgeName.graphml", "random(edge_coverage(100))"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), + assertThat(result.getError(), is("When parsing model: 'graphml/IncorrectModels/badEdgeName.graphml' The string '1_badName' did not conform to GraphWalker syntax rules." + System.lineSeparator() + System.lineSeparator() + "An error occurred when running command: offline -m graphml/IncorrectModels/badEdgeName.graphml random(edge_coverage(100))" + System.lineSeparator() + "Model syntax error" + System.lineSeparator() + System.lineSeparator())); - Assert.assertThat(result.getOutput(), is("")); + assertThat(result.getOutput(), is("")); } /** @@ -101,13 +101,13 @@ public void badEdgeName() { public void badVertexName() { String args[] = {"offline", "-m", "graphml/IncorrectModels/badVertexName.graphml", "random(edge_coverage(100))"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), + assertThat(result.getError(), is("When parsing model: 'graphml/IncorrectModels/badVertexName.graphml' The string '1_badName' did not conform to GraphWalker syntax rules." + System.lineSeparator() + System.lineSeparator() + "An error occurred when running command: offline -m graphml/IncorrectModels/badVertexName.graphml random(edge_coverage(100))" + System.lineSeparator() + "Model syntax error" + System.lineSeparator() + System.lineSeparator())); - Assert.assertThat(result.getOutput(), is("")); + assertThat(result.getOutput(), is("")); } } diff --git a/graphwalker-cli/src/test/java/org/graphwalker/cli/MethodsTest.java b/graphwalker-cli/src/test/java/org/graphwalker/cli/MethodsTest.java index ac083726..9d24f509 100644 --- a/graphwalker-cli/src/test/java/org/graphwalker/cli/MethodsTest.java +++ b/graphwalker-cli/src/test/java/org/graphwalker/cli/MethodsTest.java @@ -26,12 +26,12 @@ package org.graphwalker.cli; -import org.junit.Assert; import org.junit.Test; import java.io.IOException; import java.util.Arrays; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.core.Is.is; @@ -42,8 +42,8 @@ public class MethodsTest extends CLITestRoot { public void methodsDontUseBlockedFeature() throws IOException { String args[] = {"methods", "-b", "false", "-m", "json/graphWithBlockedElements.json"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertThat(Arrays.asList(result.getOutput().split("\\s+")), + assertThat(result.getError(), is("")); + assertThat(Arrays.asList(result.getOutput().split("\\s+")), containsInAnyOrder("e1", "e2", "e3", @@ -65,8 +65,8 @@ public void methodsDontUseBlockedFeature() throws IOException { public void methodsUseBlockedFeature() throws IOException { String args[] = {"methods", "-m", "json/graphWithBlockedElements.json"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertThat(Arrays.asList(result.getOutput().split("\\s+")), + assertThat(result.getError(), is("")); + assertThat(Arrays.asList(result.getOutput().split("\\s+")), containsInAnyOrder("e1", "e2", "e3", diff --git a/graphwalker-cli/src/test/java/org/graphwalker/cli/PrintHelpTest.java b/graphwalker-cli/src/test/java/org/graphwalker/cli/PrintHelpTest.java index 07c03f3f..5ac67d31 100644 --- a/graphwalker-cli/src/test/java/org/graphwalker/cli/PrintHelpTest.java +++ b/graphwalker-cli/src/test/java/org/graphwalker/cli/PrintHelpTest.java @@ -26,12 +26,12 @@ package org.graphwalker.cli; -import org.junit.Assert; import org.junit.Test; import java.io.IOException; import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; @@ -41,7 +41,7 @@ public class PrintHelpTest extends CLITestRoot { public void help() throws IOException { String args[] = {"--help"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertThat(result.getOutput(), containsString("Usage: graphwalker [options] [command] [command options]")); + assertThat(result.getError(), is("")); + assertThat(result.getOutput(), containsString("Usage: graphwalker [options] [command] [command options]")); } } diff --git a/graphwalker-cli/src/test/java/org/graphwalker/cli/PrintVersionTest.java b/graphwalker-cli/src/test/java/org/graphwalker/cli/PrintVersionTest.java index c687ca36..c39754ee 100644 --- a/graphwalker-cli/src/test/java/org/graphwalker/cli/PrintVersionTest.java +++ b/graphwalker-cli/src/test/java/org/graphwalker/cli/PrintVersionTest.java @@ -26,12 +26,12 @@ package org.graphwalker.cli; -import org.junit.Assert; import org.junit.Test; import java.io.IOException; import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; @@ -41,7 +41,7 @@ public class PrintVersionTest extends CLITestRoot { public void version() throws IOException { String args[] = {"--version"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertThat(result.getOutput(), containsString("org.graphwalker version: ")); + assertThat(result.getError(), is("")); + assertThat(result.getOutput(), containsString("org.graphwalker version: ")); } } diff --git a/graphwalker-cli/src/test/java/org/graphwalker/cli/RequirementsTest.java b/graphwalker-cli/src/test/java/org/graphwalker/cli/RequirementsTest.java index 86e40645..e4de582e 100644 --- a/graphwalker-cli/src/test/java/org/graphwalker/cli/RequirementsTest.java +++ b/graphwalker-cli/src/test/java/org/graphwalker/cli/RequirementsTest.java @@ -26,13 +26,13 @@ package org.graphwalker.cli; -import org.junit.Assert; import org.junit.Test; import java.io.IOException; import java.util.Arrays; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.core.Is.is; @@ -43,13 +43,13 @@ public class RequirementsTest extends CLITestRoot { public void requirements() throws IOException { String args[] = {"requirements", "-m", "graphml/online/ShoppingCart.graphml"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); + assertThat(result.getError(), is("")); List array = Arrays.asList(result.getOutput().split("\n")); for (int i = 0; i < array.size(); i++) { array.set(i, array.get(i).trim()); } - Assert.assertThat(array, + assertThat(array, containsInAnyOrder("UC01 2.2.1", "UC01 2.2.2", "UC01 2.2.3", diff --git a/graphwalker-cli/src/test/java/org/graphwalker/cli/SourceTest.java b/graphwalker-cli/src/test/java/org/graphwalker/cli/SourceTest.java index 1939123c..4f460271 100644 --- a/graphwalker-cli/src/test/java/org/graphwalker/cli/SourceTest.java +++ b/graphwalker-cli/src/test/java/org/graphwalker/cli/SourceTest.java @@ -26,12 +26,13 @@ package org.graphwalker.cli; -import org.junit.Assert; import org.junit.Test; import java.io.IOException; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertTrue; public class SourceTest extends CLITestRoot { @@ -40,15 +41,15 @@ public class SourceTest extends CLITestRoot { public void generatePerl() throws IOException { String args[] = {"source", "--input", "json/example.json", "template/perl.template"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertTrue(result.getOutput().length() > 1200 && result.getOutput().length() < 1300); + assertThat(result.getError(), is("")); + assertTrue(result.getOutput().length() > 1200 && result.getOutput().length() < 1300); } @Test public void generatePython() throws IOException { String args[] = {"source", "--input", "json/example.json", "template/python.template"}; Result result = runCommand(args); - Assert.assertThat(result.getError(), is("")); - Assert.assertTrue(result.getOutput().length() > 950 && result.getOutput().length() < 1150); + assertThat(result.getError(), is("")); + assertTrue(result.getOutput().length() > 950 && result.getOutput().length() < 1150); } } diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/AStarTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/AStarTest.java index 49c7355c..aa6f7166 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/AStarTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/AStarTest.java @@ -30,9 +30,9 @@ import org.graphwalker.core.model.*; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/DepthFirstSearchTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/DepthFirstSearchTest.java index 41a3ad87..86d404ce 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/DepthFirstSearchTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/DepthFirstSearchTest.java @@ -32,8 +32,8 @@ import org.graphwalker.core.model.Vertex; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/EulerianTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/EulerianTest.java index a2e9bcff..39bfc30a 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/EulerianTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/EulerianTest.java @@ -32,8 +32,8 @@ import org.graphwalker.core.model.Vertex; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/FloydWarshallTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/FloydWarshallTest.java index 08276e4d..f7e36671 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/FloydWarshallTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/algorithm/FloydWarshallTest.java @@ -32,8 +32,8 @@ import org.graphwalker.core.model.Vertex; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/condition/AlternativeConditionTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/condition/AlternativeConditionTest.java index 56208da1..061b7dfd 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/condition/AlternativeConditionTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/condition/AlternativeConditionTest.java @@ -36,8 +36,10 @@ import org.graphwalker.core.model.Vertex; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/condition/CombinedConditionTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/condition/CombinedConditionTest.java index bbaffc36..4137b01b 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/condition/CombinedConditionTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/condition/CombinedConditionTest.java @@ -28,9 +28,9 @@ import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/condition/DependencyEdgeCoverageTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/condition/DependencyEdgeCoverageTest.java index d5eee1e9..71d2f490 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/condition/DependencyEdgeCoverageTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/condition/DependencyEdgeCoverageTest.java @@ -35,8 +35,10 @@ import org.graphwalker.core.statistics.SimpleProfiler; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * @author Miroslav Janeski diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/condition/EdgeCoverageTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/condition/EdgeCoverageTest.java index e819f38b..88ef0361 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/condition/EdgeCoverageTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/condition/EdgeCoverageTest.java @@ -35,8 +35,10 @@ import org.graphwalker.core.statistics.SimpleProfiler; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/condition/LengthTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/condition/LengthTest.java index 67354813..3f51fdd3 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/condition/LengthTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/condition/LengthTest.java @@ -34,8 +34,10 @@ import org.graphwalker.core.statistics.SimpleProfiler; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/condition/NeverTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/condition/NeverTest.java index 948182b3..d9acfc6d 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/condition/NeverTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/condition/NeverTest.java @@ -28,8 +28,10 @@ import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/condition/PredefinedPathStopConditionTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/condition/PredefinedPathStopConditionTest.java index f876fa77..332805ba 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/condition/PredefinedPathStopConditionTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/condition/PredefinedPathStopConditionTest.java @@ -9,8 +9,10 @@ import java.util.Arrays; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; public class PredefinedPathStopConditionTest { diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/condition/ReachedEdgeTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/condition/ReachedEdgeTest.java index 2002443d..624287e3 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/condition/ReachedEdgeTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/condition/ReachedEdgeTest.java @@ -34,8 +34,10 @@ import org.graphwalker.core.model.Vertex; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/condition/ReachedSharedStateTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/condition/ReachedSharedStateTest.java index d7894fbb..6144730a 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/condition/ReachedSharedStateTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/condition/ReachedSharedStateTest.java @@ -39,8 +39,8 @@ import java.util.List; import java.util.stream.Collectors; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/condition/ReachedVertexTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/condition/ReachedVertexTest.java index bdfd8cfd..0c9d9963 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/condition/ReachedVertexTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/condition/ReachedVertexTest.java @@ -34,8 +34,10 @@ import org.graphwalker.core.model.Vertex; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/condition/RequirementCoverageTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/condition/RequirementCoverageTest.java index 889f2d47..10923c69 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/condition/RequirementCoverageTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/condition/RequirementCoverageTest.java @@ -34,6 +34,7 @@ import org.graphwalker.core.model.Vertex; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.*; diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/condition/TimeDurationTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/condition/TimeDurationTest.java index 318b1886..09cdc55d 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/condition/TimeDurationTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/condition/TimeDurationTest.java @@ -38,8 +38,10 @@ import java.util.concurrent.TimeUnit; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/condition/VertexCoverageTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/condition/VertexCoverageTest.java index fd54bc5d..d164a397 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/condition/VertexCoverageTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/condition/VertexCoverageTest.java @@ -35,8 +35,10 @@ import org.graphwalker.core.statistics.SimpleProfiler; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/event/ObserverTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/event/ObserverTest.java index faba676e..4d3dae98 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/event/ObserverTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/event/ObserverTest.java @@ -40,6 +40,7 @@ import static org.graphwalker.core.event.EventType.AFTER_ELEMENT; import static org.graphwalker.core.event.EventType.BEFORE_ELEMENT; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.*; diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/example/ExampleTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/example/ExampleTest.java index 3de6c08b..1eb0ba5b 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/example/ExampleTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/example/ExampleTest.java @@ -32,8 +32,8 @@ import org.graphwalker.core.model.*; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; /** diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/generator/CombinedPathTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/generator/CombinedPathTest.java index 6573ff95..e3da0404 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/generator/CombinedPathTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/generator/CombinedPathTest.java @@ -42,9 +42,9 @@ import java.util.List; import java.util.stream.Collectors; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/machine/FailedEdgeRequirementTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/machine/FailedEdgeRequirementTest.java index 382a0c55..8e666154 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/machine/FailedEdgeRequirementTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/machine/FailedEdgeRequirementTest.java @@ -35,8 +35,8 @@ import org.graphwalker.core.model.Vertex; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/machine/LoginModelTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/machine/LoginModelTest.java index a9ebfaf4..36205e00 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/machine/LoginModelTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/machine/LoginModelTest.java @@ -39,9 +39,9 @@ import java.util.List; import java.util.stream.Collectors; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertThat; /** * This is a programatic implementaion of the loginModel: diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/machine/ReplayMachineTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/machine/ReplayMachineTest.java index 8234fd43..e179627f 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/machine/ReplayMachineTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/machine/ReplayMachineTest.java @@ -35,8 +35,8 @@ import java.util.List; import java.util.stream.Collectors; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/machine/SimpleMachineTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/machine/SimpleMachineTest.java index 7d86a933..439451a7 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/machine/SimpleMachineTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/machine/SimpleMachineTest.java @@ -38,6 +38,7 @@ import java.util.stream.Collectors; import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.*; diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/model/ClassificationTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/model/ClassificationTest.java index 5443fb5c..d89fecd3 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/model/ClassificationTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/model/ClassificationTest.java @@ -29,8 +29,10 @@ import org.junit.Test; import static org.graphwalker.core.model.Classification.RuntimeClassification; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/model/ClassificationTreeTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/model/ClassificationTreeTest.java index 11785c0f..ce822386 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/model/ClassificationTreeTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/model/ClassificationTreeTest.java @@ -29,8 +29,10 @@ import org.junit.Test; import static org.graphwalker.core.model.ClassificationTree.RuntimeClassificationTree; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/model/EdgeTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/model/EdgeTest.java index 9a18820e..1822d53f 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/model/EdgeTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/model/EdgeTest.java @@ -30,6 +30,7 @@ import java.util.Arrays; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; import static org.junit.Assert.*; diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/model/ModelTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/model/ModelTest.java index ef6d9d67..3f3b0a0a 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/model/ModelTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/model/ModelTest.java @@ -34,6 +34,7 @@ import java.util.Random; import java.util.concurrent.TimeUnit; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNull.notNullValue; diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/model/RequirementTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/model/RequirementTest.java index cf4c45a0..0d33344b 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/model/RequirementTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/model/RequirementTest.java @@ -33,8 +33,10 @@ import org.graphwalker.core.machine.*; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/model/VertexTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/model/VertexTest.java index f97201f3..27d92113 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/model/VertexTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/model/VertexTest.java @@ -30,6 +30,7 @@ import java.util.Arrays; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; import static org.junit.Assert.*; diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/model/VisitorTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/model/VisitorTest.java index 8c97ec1d..ce08974f 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/model/VisitorTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/model/VisitorTest.java @@ -34,8 +34,10 @@ import static org.graphwalker.core.model.Edge.RuntimeEdge; import static org.graphwalker.core.model.Model.RuntimeModel; import static org.graphwalker.core.model.Vertex.RuntimeVertex; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/statistics/ExecutionTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/statistics/ExecutionTest.java index bc54c071..0905656d 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/statistics/ExecutionTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/statistics/ExecutionTest.java @@ -34,9 +34,9 @@ import java.util.concurrent.TimeUnit; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; /** * @author Nils Olsson diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/statistics/ProfileTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/statistics/ProfileTest.java index 1725b6eb..37a38adb 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/statistics/ProfileTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/statistics/ProfileTest.java @@ -35,8 +35,8 @@ import java.util.Collections; import java.util.concurrent.TimeUnit; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; public class ProfileTest { diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/statistics/ProfilerTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/statistics/ProfilerTest.java index cd889193..eb898ace 100644 --- a/graphwalker-core/src/test/java/org/graphwalker/core/statistics/ProfilerTest.java +++ b/graphwalker-core/src/test/java/org/graphwalker/core/statistics/ProfilerTest.java @@ -40,10 +40,12 @@ import java.util.Arrays; import java.util.HashSet; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.core.Is.is; import static org.junit.Assert.*; + /** * @author Nils Olsson */ diff --git a/graphwalker-dsl/src/test/java/org/graphwalker/dsl/GeneratorFactoryTest.java b/graphwalker-dsl/src/test/java/org/graphwalker/dsl/GeneratorFactoryTest.java index 7e927560..bb63fb97 100644 --- a/graphwalker-dsl/src/test/java/org/graphwalker/dsl/GeneratorFactoryTest.java +++ b/graphwalker-dsl/src/test/java/org/graphwalker/dsl/GeneratorFactoryTest.java @@ -32,7 +32,6 @@ import org.graphwalker.dsl.antlr.generator.GeneratorFactory; import org.graphwalker.dsl.antlr.generator.GeneratorFactoryException; import org.graphwalker.generator.PluginGenerator; -import org.junit.Assert; import org.junit.Test; import static org.hamcrest.MatcherAssert.assertThat; @@ -312,8 +311,8 @@ public void predefinedPath_predefinedPathStopCondition() { @Test public void plugin_generator() { PathGenerator generator = GeneratorFactory.parse("pluginGenerator(edge_coverage(100))"); - Assert.assertThat(generator, instanceOf(PluginGenerator.class)); - Assert.assertThat(generator.getStopCondition(), instanceOf(EdgeCoverage.class)); - Assert.assertThat(((EdgeCoverage) generator.getStopCondition()).getPercent(), is(100)); + assertThat(generator, instanceOf(PluginGenerator.class)); + assertThat(generator.getStopCondition(), instanceOf(EdgeCoverage.class)); + assertThat(((EdgeCoverage) generator.getStopCondition()).getPercent(), is(100)); } } diff --git a/graphwalker-dsl/src/test/java/org/graphwalker/dsl/GrammarTest.java b/graphwalker-dsl/src/test/java/org/graphwalker/dsl/GrammarTest.java index 424451ba..7af806f3 100644 --- a/graphwalker-dsl/src/test/java/org/graphwalker/dsl/GrammarTest.java +++ b/graphwalker-dsl/src/test/java/org/graphwalker/dsl/GrammarTest.java @@ -31,12 +31,12 @@ import org.antlr.v4.runtime.CommonTokenStream; import org.graphwalker.dsl.generator.GeneratorParser; import org.graphwalker.dsl.generator.LogicalLexer; -import org.junit.Assert; import org.junit.Test; import java.util.Arrays; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; /** @@ -73,7 +73,7 @@ public void testCLI() { CommonTokenStream tokens = new CommonTokenStream(lexer); GeneratorParser parser = new GeneratorParser(tokens); GeneratorParser.ParseContext context = parser.parse(); - Assert.assertThat("Could not parse: " + generator, parser.getNumberOfSyntaxErrors(), is(0)); + assertThat("Could not parse: " + generator, parser.getNumberOfSyntaxErrors(), is(0)); } } } diff --git a/graphwalker-dsl/src/test/java/org/graphwalker/yed/GrammarTest.java b/graphwalker-dsl/src/test/java/org/graphwalker/yed/GrammarTest.java index 23a1dfaf..f6074913 100644 --- a/graphwalker-dsl/src/test/java/org/graphwalker/yed/GrammarTest.java +++ b/graphwalker-dsl/src/test/java/org/graphwalker/yed/GrammarTest.java @@ -32,12 +32,12 @@ import org.graphwalker.dsl.yed.YEdEdgeParser; import org.graphwalker.dsl.yed.YEdLabelLexer; import org.graphwalker.dsl.yed.YEdVertexParser; -import org.junit.Assert; import org.junit.Test; import java.util.Arrays; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; /** @@ -126,7 +126,7 @@ public void testVertexParser() { CommonTokenStream tokens = new CommonTokenStream(lexer); YEdVertexParser parser = new YEdVertexParser(tokens); parser.parse(); - Assert.assertThat("Could not parse: " + vertex, parser.getNumberOfSyntaxErrors(), is(0)); + assertThat("Could not parse: " + vertex, parser.getNumberOfSyntaxErrors(), is(0)); } } @@ -138,7 +138,7 @@ public void testEdgeParser() { CommonTokenStream tokens = new CommonTokenStream(lexer); YEdEdgeParser parser = new YEdEdgeParser(tokens); parser.parse(); - Assert.assertThat("Could not parse: " + edge, parser.getNumberOfSyntaxErrors(), is(0)); + assertThat("Could not parse: " + edge, parser.getNumberOfSyntaxErrors(), is(0)); } } } diff --git a/graphwalker-io/src/test/java/org/graphwalker/io/common/UtilTest.java b/graphwalker-io/src/test/java/org/graphwalker/io/common/UtilTest.java index 527f6318..ac2fb0e1 100644 --- a/graphwalker-io/src/test/java/org/graphwalker/io/common/UtilTest.java +++ b/graphwalker-io/src/test/java/org/graphwalker/io/common/UtilTest.java @@ -35,9 +35,9 @@ import java.nio.file.Paths; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; /** * Created by krikar on 2015-11-04. diff --git a/graphwalker-io/src/test/java/org/graphwalker/io/factory/ConvertionContextFactoryTest.java b/graphwalker-io/src/test/java/org/graphwalker/io/factory/ConvertionContextFactoryTest.java index e63c4633..1f70112d 100644 --- a/graphwalker-io/src/test/java/org/graphwalker/io/factory/ConvertionContextFactoryTest.java +++ b/graphwalker-io/src/test/java/org/graphwalker/io/factory/ConvertionContextFactoryTest.java @@ -43,9 +43,9 @@ import java.nio.file.Paths; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; /** * @author Kristian Karl diff --git a/graphwalker-io/src/test/java/org/graphwalker/io/factory/dot/DotContextFactoryTest.java b/graphwalker-io/src/test/java/org/graphwalker/io/factory/dot/DotContextFactoryTest.java index 52a5f5ec..eb4309f0 100644 --- a/graphwalker-io/src/test/java/org/graphwalker/io/factory/dot/DotContextFactoryTest.java +++ b/graphwalker-io/src/test/java/org/graphwalker/io/factory/dot/DotContextFactoryTest.java @@ -34,8 +34,10 @@ import java.nio.file.Paths; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; /** * @author Kristian Karl diff --git a/graphwalker-io/src/test/java/org/graphwalker/io/label/yed/YEdLabelTest.java b/graphwalker-io/src/test/java/org/graphwalker/io/label/yed/YEdLabelTest.java index 8f9abbb9..3f3d8754 100644 --- a/graphwalker-io/src/test/java/org/graphwalker/io/label/yed/YEdLabelTest.java +++ b/graphwalker-io/src/test/java/org/graphwalker/io/label/yed/YEdLabelTest.java @@ -37,9 +37,9 @@ import java.util.Arrays; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; /** * @author Nils Olsson diff --git a/graphwalker-io/src/test/java/org/graphwalker/io/xmlbeans/yed/XMLBeansTest.java b/graphwalker-io/src/test/java/org/graphwalker/io/xmlbeans/yed/XMLBeansTest.java index 07c7b04d..d0bcd5d6 100644 --- a/graphwalker-io/src/test/java/org/graphwalker/io/xmlbeans/yed/XMLBeansTest.java +++ b/graphwalker-io/src/test/java/org/graphwalker/io/xmlbeans/yed/XMLBeansTest.java @@ -32,8 +32,8 @@ import java.io.IOException; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; /** * @author Nils Olsson diff --git a/graphwalker-java/src/test/java/org/graphwalker/java/annotation/AnnotationTest.java b/graphwalker-java/src/test/java/org/graphwalker/java/annotation/AnnotationTest.java index a5c37f74..95ea3398 100644 --- a/graphwalker-java/src/test/java/org/graphwalker/java/annotation/AnnotationTest.java +++ b/graphwalker-java/src/test/java/org/graphwalker/java/annotation/AnnotationTest.java @@ -34,6 +34,7 @@ import java.util.Set; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; /** @@ -44,26 +45,26 @@ public class AnnotationTest { @Test public void getAnnotationsTest() { Set annotations = AnnotationUtils.getAnnotations(MyTest.class, GraphWalker.class); - Assert.assertThat(annotations.size(), is(1)); + assertThat(annotations.size(), is(1)); Assert.assertTrue(annotations.toArray()[0] instanceof GraphWalker); GraphWalker annotation = (GraphWalker) annotations.toArray()[0]; - Assert.assertThat(annotation.start(), is("vertex1")); - Assert.assertThat(annotation.groups(), is(new String[]{"MyTests"})); + assertThat(annotation.start(), is("vertex1")); + assertThat(annotation.groups(), is(new String[]{"MyTests"})); Assert.assertTrue(RandomPath.class.isAssignableFrom(annotation.pathGenerator())); Assert.assertTrue(VertexCoverage.class.isAssignableFrom(annotation.stopCondition())); - Assert.assertThat(annotation.stopConditionValue(), is("100")); - Assert.assertThat(AnnotationUtils.getAnnotations(MyTest.class, Vertex.class).size(), is(0)); + assertThat(annotation.stopConditionValue(), is("100")); + assertThat(AnnotationUtils.getAnnotations(MyTest.class, Vertex.class).size(), is(0)); } @Test public void executeTest() { MyTest myTest = new MyTest(); AnnotationUtils.execute(BeforeExecution.class, myTest); - Assert.assertThat(myTest.getCount(), is(1)); + assertThat(myTest.getCount(), is(1)); AnnotationUtils.execute(AfterExecution.class, myTest); - Assert.assertThat(myTest.getCount(), is(2)); + assertThat(myTest.getCount(), is(2)); AnnotationUtils.execute(BeforeElement.class, myTest); - Assert.assertThat(myTest.getCount(), is(3)); + assertThat(myTest.getCount(), is(3)); } @Test diff --git a/graphwalker-java/src/test/java/org/graphwalker/java/report/ReportTest.java b/graphwalker-java/src/test/java/org/graphwalker/java/report/ReportTest.java index 16fa3c53..643a5590 100644 --- a/graphwalker-java/src/test/java/org/graphwalker/java/report/ReportTest.java +++ b/graphwalker-java/src/test/java/org/graphwalker/java/report/ReportTest.java @@ -43,7 +43,7 @@ import java.util.Date; import java.util.List; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.xmlunit.matchers.HasXPathMatcher.hasXPath; /** diff --git a/graphwalker-java/src/test/java/org/graphwalker/java/source/GenerateTest.java b/graphwalker-java/src/test/java/org/graphwalker/java/source/GenerateTest.java index 21fff1ee..884aa2c0 100644 --- a/graphwalker-java/src/test/java/org/graphwalker/java/source/GenerateTest.java +++ b/graphwalker-java/src/test/java/org/graphwalker/java/source/GenerateTest.java @@ -28,7 +28,6 @@ import org.graphwalker.io.common.ResourceUtils; import org.json.JSONObject; -import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; @@ -46,6 +45,7 @@ import static org.graphwalker.java.utils.OccurrencesOfString.occurrencesOfString; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.stringContainsInOrder; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsEqual.equalTo; @@ -61,32 +61,32 @@ public class GenerateTest { @Test public void generate() throws IOException { List sources = new CodeGenerator().generate("/org/graphwalker/java/annotation/MyModel.graphml"); - Assert.assertThat(sources.size(), is(1)); - Assert.assertThat(sources.get(0), containsString("package org.graphwalker.java.annotation;")); - Assert.assertThat(sources.get(0), containsString("edge12")); - Assert.assertThat(sources.get(0), containsString("vertex2")); - Assert.assertThat(sources.get(0), not(containsString("SHARED"))); + assertThat(sources.size(), is(1)); + assertThat(sources.get(0), containsString("package org.graphwalker.java.annotation;")); + assertThat(sources.get(0), containsString("edge12")); + assertThat(sources.get(0), containsString("vertex2")); + assertThat(sources.get(0), not(containsString("SHARED"))); } @Test public void generatePathWithSpace() throws IOException { List sources = new CodeGenerator().generate("/org/graphwalker/java/path with space/MyModel.graphml"); - Assert.assertThat(sources.size(), is(1)); - Assert.assertThat(sources.get(0), containsString("edge12")); - Assert.assertThat(sources.get(0), containsString("vertex2")); - Assert.assertThat(sources.get(0), not(containsString("SHARED"))); - Assert.assertThat(sources.get(0), containsString("package org.graphwalker.java.path_with_space;")); + assertThat(sources.size(), is(1)); + assertThat(sources.get(0), containsString("edge12")); + assertThat(sources.get(0), containsString("vertex2")); + assertThat(sources.get(0), not(containsString("SHARED"))); + assertThat(sources.get(0), containsString("package org.graphwalker.java.path_with_space;")); } @Test public void generateMultiModelFile() throws IOException { List sources = new CodeGenerator().generate("/org/graphwalker/java/test/PetClinic.json"); - Assert.assertThat(sources.size(), is(5)); + assertThat(sources.size(), is(5)); - Assert.assertThat(sources.get(0), containsString("public interface FindOwners {")); - Assert.assertThat(sources.get(0), occurrencesOfString("@Vertex()", 3)); - Assert.assertThat(sources.get(0), occurrencesOfString("@Edge()", 3)); - Assert.assertThat(sources.get(0), stringContainsInOrder(Arrays.asList( + assertThat(sources.get(0), containsString("public interface FindOwners {")); + assertThat(sources.get(0), occurrencesOfString("@Vertex()", 3)); + assertThat(sources.get(0), occurrencesOfString("@Edge()", 3)); + assertThat(sources.get(0), stringContainsInOrder(Arrays.asList( "void e_AddOwner();", "void v_FindOwners();", "void e_Search();", @@ -94,10 +94,10 @@ public void generateMultiModelFile() throws IOException { "void v_NewOwner();" ))); - Assert.assertThat(sources.get(1), containsString("public interface NewOwner {")); - Assert.assertThat(sources.get(1), occurrencesOfString("@Vertex()", 3)); - Assert.assertThat(sources.get(1), occurrencesOfString("@Edge()", 2)); - Assert.assertThat(sources.get(1), stringContainsInOrder(Arrays.asList( + assertThat(sources.get(1), containsString("public interface NewOwner {")); + assertThat(sources.get(1), occurrencesOfString("@Vertex()", 3)); + assertThat(sources.get(1), occurrencesOfString("@Edge()", 2)); + assertThat(sources.get(1), stringContainsInOrder(Arrays.asList( "void v_OwnerInformation();", "void e_CorrectData();", "void e_IncorrectData();", @@ -105,10 +105,10 @@ public void generateMultiModelFile() throws IOException { "void v_NewOwner();" ))); - Assert.assertThat(sources.get(2), containsString("public interface OwnerInformation {")); - Assert.assertThat(sources.get(2), occurrencesOfString("@Vertex()", 5)); - Assert.assertThat(sources.get(2), occurrencesOfString("@Edge()", 9)); - Assert.assertThat(sources.get(2), stringContainsInOrder(Arrays.asList( + assertThat(sources.get(2), containsString("public interface OwnerInformation {")); + assertThat(sources.get(2), occurrencesOfString("@Vertex()", 5)); + assertThat(sources.get(2), occurrencesOfString("@Edge()", 9)); + assertThat(sources.get(2), stringContainsInOrder(Arrays.asList( "void v_OwnerInformation();", "void e_UpdatePet();", "void v_FindOwners();", @@ -125,10 +125,10 @@ public void generateMultiModelFile() throws IOException { "void e_VisitAddedFailed();" ))); - Assert.assertThat(sources.get(3), containsString("public interface PetClinic {")); - Assert.assertThat(sources.get(3), occurrencesOfString("@Vertex()", 3)); - Assert.assertThat(sources.get(3), occurrencesOfString("@Edge()", 4)); - Assert.assertThat(sources.get(3), stringContainsInOrder(Arrays.asList( + assertThat(sources.get(3), containsString("public interface PetClinic {")); + assertThat(sources.get(3), occurrencesOfString("@Vertex()", 3)); + assertThat(sources.get(3), occurrencesOfString("@Edge()", 4)); + assertThat(sources.get(3), stringContainsInOrder(Arrays.asList( "void v_FindOwners();", "void e_HomePage();", "void e_StartBrowser();", @@ -137,10 +137,10 @@ public void generateMultiModelFile() throws IOException { "void v_HomePage();" ))); - Assert.assertThat(sources.get(4), containsString("public interface Veterinarians {")); - Assert.assertThat(sources.get(4), occurrencesOfString("@Vertex()", 2)); - Assert.assertThat(sources.get(4), occurrencesOfString("@Edge()", 1)); - Assert.assertThat(sources.get(4), stringContainsInOrder(Arrays.asList( + assertThat(sources.get(4), containsString("public interface Veterinarians {")); + assertThat(sources.get(4), occurrencesOfString("@Vertex()", 2)); + assertThat(sources.get(4), occurrencesOfString("@Edge()", 1)); + assertThat(sources.get(4), stringContainsInOrder(Arrays.asList( "void e_Search();", "void v_SearchResult();", "void v_Veterinarians();" @@ -181,10 +181,10 @@ public void generateAndWriteFromGraphml() throws IOException { JSONAssert.assertEquals(expected, data, false); File sourceFile = new File(tmpFolder + "/org/graphwalker/java/graphml/MyModel.java"); - Assert.assertThat(sourceFile.exists(), is(true)); + assertThat(sourceFile.exists(), is(true)); String content = readFile(sourceFile.toPath(), StandardCharsets.UTF_8); - Assert.assertThat(content, equalTo( + assertThat(content, equalTo( "// Generated by GraphWalker (http://www.graphwalker.org)\n" + "package org.graphwalker.java.graphml;\n" + "\n" + @@ -235,9 +235,9 @@ public void incorrectGraphml() throws IOException { JSONAssert.assertEquals(expected, data, false); File sourceDir = new File(tmpFolder + "/org"); - Assert.assertThat(sourceDir.exists(), is(false)); + assertThat(sourceDir.exists(), is(false)); File sourceFile = new File(tmpFolder + "/org/graphwalker/java/graphml/MyModel.java"); - Assert.assertThat(sourceFile.exists(), is(false)); + assertThat(sourceFile.exists(), is(false)); } } diff --git a/graphwalker-java/src/test/java/org/graphwalker/java/source/SourceFileTest.java b/graphwalker-java/src/test/java/org/graphwalker/java/source/SourceFileTest.java index aaa2e3f6..0116f978 100644 --- a/graphwalker-java/src/test/java/org/graphwalker/java/source/SourceFileTest.java +++ b/graphwalker-java/src/test/java/org/graphwalker/java/source/SourceFileTest.java @@ -5,8 +5,8 @@ import java.io.IOException; import java.nio.file.Paths; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; public class SourceFileTest { diff --git a/graphwalker-java/src/test/java/org/graphwalker/java/test/ConfigurationTest.java b/graphwalker-java/src/test/java/org/graphwalker/java/test/ConfigurationTest.java index 6f782dc3..62bc6aec 100644 --- a/graphwalker-java/src/test/java/org/graphwalker/java/test/ConfigurationTest.java +++ b/graphwalker-java/src/test/java/org/graphwalker/java/test/ConfigurationTest.java @@ -26,10 +26,11 @@ * #L% */ -import org.junit.Assert; import org.junit.Test; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertNotNull; /** * @author Nils Olsson @@ -40,18 +41,18 @@ public class ConfigurationTest { public void configurationTest() { Configuration configuration = new Configuration(); configuration.addExclude("exclude"); - Assert.assertThat(configuration.getExcludes().size(), is(1)); + assertThat(configuration.getExcludes().size(), is(1)); configuration.addInclude("include"); - Assert.assertThat(configuration.getIncludes().size(), is(1)); + assertThat(configuration.getIncludes().size(), is(1)); configuration.addGroup("group"); - Assert.assertThat(configuration.getGroups().size(), is(1)); + assertThat(configuration.getGroups().size(), is(1)); } @Test public void minimalConfigurationTest() { Configuration configuration = new Configuration(); - Assert.assertNotNull(configuration.getExcludes()); - Assert.assertNotNull(configuration.getIncludes()); - Assert.assertNotNull(configuration.getGroups()); + assertNotNull(configuration.getExcludes()); + assertNotNull(configuration.getIncludes()); + assertNotNull(configuration.getGroups()); } } diff --git a/graphwalker-java/src/test/java/org/graphwalker/java/test/ResultTest.java b/graphwalker-java/src/test/java/org/graphwalker/java/test/ResultTest.java index a34b907e..a2231ea2 100644 --- a/graphwalker-java/src/test/java/org/graphwalker/java/test/ResultTest.java +++ b/graphwalker-java/src/test/java/org/graphwalker/java/test/ResultTest.java @@ -30,7 +30,6 @@ import org.graphwalker.io.factory.json.JsonContextFactory; import org.hamcrest.core.StringStartsWith; import org.json.JSONObject; -import org.junit.Assert; import org.junit.Test; import java.io.IOException; @@ -40,6 +39,7 @@ import java.util.Collections; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; @@ -57,20 +57,20 @@ public void petClinic() throws IOException { Executor executor = new TestExecutor(contexts); JSONObject results = executor.execute(true).getResults(); - Assert.assertThat("totalNumberOfModels", results.getInt("totalNumberOfModels"), is(5)); - Assert.assertThat("totalCompletedNumberOfModels", results.getInt("totalCompletedNumberOfModels"), is(5)); - Assert.assertThat("totalIncompleteNumberOfModels", results.getInt("totalIncompleteNumberOfModels"), is(0)); - Assert.assertThat("totalFailedNumberOfModels", results.getInt("totalFailedNumberOfModels"), is(0)); - Assert.assertThat("totalNotExecutedNumberOfModels", results.getInt("totalNotExecutedNumberOfModels"), is(0)); - - Assert.assertThat("vertexCoverage", results.getInt("vertexCoverage"), is(100)); - Assert.assertThat("totalNumberOfEdges", results.getInt("totalNumberOfEdges"), is(25)); - Assert.assertThat("totalNumberOfVisitedVertices", results.getInt("totalNumberOfVisitedVertices"), is(16)); - Assert.assertThat("totalNumberOfUnvisitedVertices", results.getInt("totalNumberOfUnvisitedVertices"), is(0)); - Assert.assertThat("totalNumberOfVisitedEdges", results.getInt("totalNumberOfVisitedEdges"), is(25)); - Assert.assertThat("edgeCoverage", results.getInt("edgeCoverage"), is(100)); - Assert.assertThat("totalNumberOfVertices", results.getInt("totalNumberOfVertices"), is(16)); - Assert.assertThat("totalNumberOfUnvisitedEdges", results.getInt("totalNumberOfUnvisitedEdges"), is(0)); + assertThat("totalNumberOfModels", results.getInt("totalNumberOfModels"), is(5)); + assertThat("totalCompletedNumberOfModels", results.getInt("totalCompletedNumberOfModels"), is(5)); + assertThat("totalIncompleteNumberOfModels", results.getInt("totalIncompleteNumberOfModels"), is(0)); + assertThat("totalFailedNumberOfModels", results.getInt("totalFailedNumberOfModels"), is(0)); + assertThat("totalNotExecutedNumberOfModels", results.getInt("totalNotExecutedNumberOfModels"), is(0)); + + assertThat("vertexCoverage", results.getInt("vertexCoverage"), is(100)); + assertThat("totalNumberOfEdges", results.getInt("totalNumberOfEdges"), is(25)); + assertThat("totalNumberOfVisitedVertices", results.getInt("totalNumberOfVisitedVertices"), is(16)); + assertThat("totalNumberOfUnvisitedVertices", results.getInt("totalNumberOfUnvisitedVertices"), is(0)); + assertThat("totalNumberOfVisitedEdges", results.getInt("totalNumberOfVisitedEdges"), is(25)); + assertThat("edgeCoverage", results.getInt("edgeCoverage"), is(100)); + assertThat("totalNumberOfVertices", results.getInt("totalNumberOfVertices"), is(16)); + assertThat("totalNumberOfUnvisitedEdges", results.getInt("totalNumberOfUnvisitedEdges"), is(0)); } /** @@ -82,36 +82,36 @@ public void login() throws IOException { Executor executor = new TestExecutor(contexts); JSONObject results = executor.execute(true).getResults(); - Assert.assertThat("totalNumberOfModels", results.getInt("totalNumberOfModels"), is(1)); - Assert.assertThat("totalCompletedNumberOfModels", results.getInt("totalCompletedNumberOfModels"), is(1)); - Assert.assertThat("totalIncompleteNumberOfModels", results.getInt("totalIncompleteNumberOfModels"), is(0)); - Assert.assertThat("totalFailedNumberOfModels", results.getInt("totalFailedNumberOfModels"), is(0)); - Assert.assertThat("totalNotExecutedNumberOfModels", results.getInt("totalNotExecutedNumberOfModels"), is(0)); - - Assert.assertThat("vertexCoverage", results.getInt("vertexCoverage"), is(100)); - Assert.assertThat("totalNumberOfEdges", results.getInt("totalNumberOfEdges"), is(9)); - Assert.assertThat("totalNumberOfVisitedVertices", results.getInt("totalNumberOfVisitedVertices"), is(3)); - Assert.assertThat("totalNumberOfUnvisitedVertices", results.getInt("totalNumberOfUnvisitedVertices"), is(0)); - Assert.assertThat("totalNumberOfVisitedEdges", results.getInt("totalNumberOfVisitedEdges"), is(9)); - Assert.assertThat("edgeCoverage", results.getInt("edgeCoverage"), is(100)); - Assert.assertThat("totalNumberOfVertices", results.getInt("totalNumberOfVertices"), is(3)); - Assert.assertThat("totalNumberOfUnvisitedEdges", results.getInt("totalNumberOfUnvisitedEdges"), is(0)); + assertThat("totalNumberOfModels", results.getInt("totalNumberOfModels"), is(1)); + assertThat("totalCompletedNumberOfModels", results.getInt("totalCompletedNumberOfModels"), is(1)); + assertThat("totalIncompleteNumberOfModels", results.getInt("totalIncompleteNumberOfModels"), is(0)); + assertThat("totalFailedNumberOfModels", results.getInt("totalFailedNumberOfModels"), is(0)); + assertThat("totalNotExecutedNumberOfModels", results.getInt("totalNotExecutedNumberOfModels"), is(0)); + + assertThat("vertexCoverage", results.getInt("vertexCoverage"), is(100)); + assertThat("totalNumberOfEdges", results.getInt("totalNumberOfEdges"), is(9)); + assertThat("totalNumberOfVisitedVertices", results.getInt("totalNumberOfVisitedVertices"), is(3)); + assertThat("totalNumberOfUnvisitedVertices", results.getInt("totalNumberOfUnvisitedVertices"), is(0)); + assertThat("totalNumberOfVisitedEdges", results.getInt("totalNumberOfVisitedEdges"), is(9)); + assertThat("edgeCoverage", results.getInt("edgeCoverage"), is(100)); + assertThat("totalNumberOfVertices", results.getInt("totalNumberOfVertices"), is(3)); + assertThat("totalNumberOfUnvisitedEdges", results.getInt("totalNumberOfUnvisitedEdges"), is(0)); // The requirement part - Assert.assertThat("totalNumberOfRequirement", results.getInt("totalNumberOfRequirement"), is(3)); - Assert.assertThat("totalNumberOfUncoveredRequirement", results.getInt("totalNumberOfUncoveredRequirement"), is(0)); - Assert.assertThat("totalNumberOfPassedRequirement", results.getInt("totalNumberOfPassedRequirement"), is(3)); + assertThat("totalNumberOfRequirement", results.getInt("totalNumberOfRequirement"), is(3)); + assertThat("totalNumberOfUncoveredRequirement", results.getInt("totalNumberOfUncoveredRequirement"), is(0)); + assertThat("totalNumberOfPassedRequirement", results.getInt("totalNumberOfPassedRequirement"), is(3)); - Assert.assertThat("requirementsPassed", results.getJSONArray("requirementsPassed").length(), is(3)); + assertThat("requirementsPassed", results.getJSONArray("requirementsPassed").length(), is(3)); List requirements = new ArrayList<>(); for (int index = 0; index < results.getJSONArray("requirementsPassed").length(); index++) { requirements.add(results.getJSONArray("requirementsPassed").getJSONObject(index).getString("requirementKey")); } List expectedRequirements = Arrays.asList("Req 1", "Req 2", "Req 3"); Collections.sort(requirements); - Assert.assertThat("requirementsPassed list", requirements.toArray(), is(expectedRequirements.toArray())); + assertThat("requirementsPassed list", requirements.toArray(), is(expectedRequirements.toArray())); - Assert.assertThat("requirementsFailed", results.getJSONArray("requirementsFailed").length(), is(0)); + assertThat("requirementsFailed", results.getJSONArray("requirementsFailed").length(), is(0)); } /** @@ -123,43 +123,43 @@ public void dualPathModel() throws IOException { Executor executor = new TestExecutor(contexts); JSONObject results = executor.execute(true).getResults(); - Assert.assertThat("totalNumberOfModels", results.getInt("totalNumberOfModels"), is(1)); - Assert.assertThat("totalCompletedNumberOfModels", results.getInt("totalCompletedNumberOfModels"), is(0)); - Assert.assertThat("totalIncompleteNumberOfModels", results.getInt("totalIncompleteNumberOfModels"), is(0)); - Assert.assertThat("totalFailedNumberOfModels", results.getInt("totalFailedNumberOfModels"), is(1)); - Assert.assertThat("totalNotExecutedNumberOfModels", results.getInt("totalNotExecutedNumberOfModels"), is(0)); - - Assert.assertThat("vertexCoverage", results.getInt("vertexCoverage"), is(75)); - Assert.assertThat("totalNumberOfEdges", results.getInt("totalNumberOfEdges"), is(5)); - Assert.assertThat("totalNumberOfVisitedVertices", results.getInt("totalNumberOfVisitedVertices"), is(3)); - Assert.assertThat("totalNumberOfUnvisitedVertices", results.getInt("totalNumberOfUnvisitedVertices"), is(1)); - Assert.assertThat("totalNumberOfVisitedEdges", results.getInt("totalNumberOfVisitedEdges"), is(3)); - Assert.assertThat("edgeCoverage", results.getInt("edgeCoverage"), is(60)); - Assert.assertThat("totalNumberOfVertices", results.getInt("totalNumberOfVertices"), is(4)); - Assert.assertThat("totalNumberOfUnvisitedEdges", results.getInt("totalNumberOfUnvisitedEdges"), is(2)); + assertThat("totalNumberOfModels", results.getInt("totalNumberOfModels"), is(1)); + assertThat("totalCompletedNumberOfModels", results.getInt("totalCompletedNumberOfModels"), is(0)); + assertThat("totalIncompleteNumberOfModels", results.getInt("totalIncompleteNumberOfModels"), is(0)); + assertThat("totalFailedNumberOfModels", results.getInt("totalFailedNumberOfModels"), is(1)); + assertThat("totalNotExecutedNumberOfModels", results.getInt("totalNotExecutedNumberOfModels"), is(0)); + + assertThat("vertexCoverage", results.getInt("vertexCoverage"), is(75)); + assertThat("totalNumberOfEdges", results.getInt("totalNumberOfEdges"), is(5)); + assertThat("totalNumberOfVisitedVertices", results.getInt("totalNumberOfVisitedVertices"), is(3)); + assertThat("totalNumberOfUnvisitedVertices", results.getInt("totalNumberOfUnvisitedVertices"), is(1)); + assertThat("totalNumberOfVisitedEdges", results.getInt("totalNumberOfVisitedEdges"), is(3)); + assertThat("edgeCoverage", results.getInt("edgeCoverage"), is(60)); + assertThat("totalNumberOfVertices", results.getInt("totalNumberOfVertices"), is(4)); + assertThat("totalNumberOfUnvisitedEdges", results.getInt("totalNumberOfUnvisitedEdges"), is(2)); // Verify the list of unvisited vertices - Assert.assertThat("verticesNotVisited", results.getJSONArray("verticesNotVisited").length(), is(1)); + assertThat("verticesNotVisited", results.getJSONArray("verticesNotVisited").length(), is(1)); List unvisitedVertices = new ArrayList<>(); for (int index = 0; index < results.getJSONArray("verticesNotVisited").length(); index++) { unvisitedVertices.add(results.getJSONArray("verticesNotVisited").getJSONObject(index).getString("vertexName")); unvisitedVertices.add(results.getJSONArray("verticesNotVisited").getJSONObject(index).getString("vertexId")); } List expectedUnvisitedVertices = Arrays.asList("v3", "n3"); - Assert.assertThat("verticesNotVisited list", unvisitedVertices.toArray(), is(expectedUnvisitedVertices.toArray())); + assertThat("verticesNotVisited list", unvisitedVertices.toArray(), is(expectedUnvisitedVertices.toArray())); // Verify the list of unvisited edges - Assert.assertThat("edgesNotVisited", results.getJSONArray("edgesNotVisited").length(), is(2)); + assertThat("edgesNotVisited", results.getJSONArray("edgesNotVisited").length(), is(2)); List unvisitedEdges = new ArrayList<>(); for (int index = 0; index < results.getJSONArray("edgesNotVisited").length(); index++) { unvisitedEdges.add(results.getJSONArray("edgesNotVisited").getJSONObject(index).getString("edgeName")); unvisitedEdges.add(results.getJSONArray("edgesNotVisited").getJSONObject(index).getString("edgeId")); } List expectedUnvisitedEdges = Arrays.asList("e3", "e2", "e5", "e4"); - Assert.assertThat("edgesNotVisited list", unvisitedEdges.toArray(), is(expectedUnvisitedEdges.toArray())); + assertThat("edgesNotVisited list", unvisitedEdges.toArray(), is(expectedUnvisitedEdges.toArray())); - Assert.assertThat("failures", results.getJSONArray("failures").length(), is(1)); - Assert.assertThat("failure text", results.getJSONArray("failures").getJSONObject(0).getString("failure"), + assertThat("failures", results.getJSONArray("failures").length(), is(1)); + assertThat("failure text", results.getJSONArray("failures").getJSONObject(0).getString("failure"), new StringStartsWith("org.graphwalker.core.generator.NoPathFoundException: Could not find a valid path from element: v2")); } } diff --git a/graphwalker-java/src/test/java/org/graphwalker/java/test/SimpleTest.java b/graphwalker-java/src/test/java/org/graphwalker/java/test/SimpleTest.java index 3535db85..27120c76 100644 --- a/graphwalker-java/src/test/java/org/graphwalker/java/test/SimpleTest.java +++ b/graphwalker-java/src/test/java/org/graphwalker/java/test/SimpleTest.java @@ -43,8 +43,8 @@ import java.util.Arrays; import java.util.Deque; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; /** * @author Nils Olsson diff --git a/graphwalker-java/src/test/java/org/graphwalker/java/test/TestExecutorTest.java b/graphwalker-java/src/test/java/org/graphwalker/java/test/TestExecutorTest.java index 0c58a538..ea0f7e19 100644 --- a/graphwalker-java/src/test/java/org/graphwalker/java/test/TestExecutorTest.java +++ b/graphwalker-java/src/test/java/org/graphwalker/java/test/TestExecutorTest.java @@ -49,6 +49,7 @@ import java.util.Arrays; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; /** @@ -158,18 +159,18 @@ public void isolation() throws MalformedURLException { MachineConfiguration mc = reflector.getMachineConfiguration(); Result result = reflector.execute(); JSONObject results = result.getResults(); - Assert.assertThat(result.getErrors().size(), is(0)); - Assert.assertThat(results.getInt("totalFailedNumberOfModels"), is(0)); - Assert.assertThat(results.getInt("totalNotExecutedNumberOfModels"), is(0)); - Assert.assertThat(results.getInt("totalNumberOfUnvisitedVertices"), is(0)); - Assert.assertThat(results.getInt("totalNumberOfModels"), is(1)); - Assert.assertThat(results.getInt("totalCompletedNumberOfModels"), is(1)); - Assert.assertThat(results.getInt("totalNumberOfVisitedEdges"), is(1)); - Assert.assertThat(results.getInt("totalIncompleteNumberOfModels"), is(0)); - Assert.assertThat(results.getInt("totalNumberOfVisitedVertices"), is(2)); - Assert.assertThat(results.getInt("edgeCoverage"), is(100)); - Assert.assertThat(results.getInt("vertexCoverage"), is(100)); - Assert.assertThat(results.getInt("totalNumberOfUnvisitedEdges"), is(0)); + assertThat(result.getErrors().size(), is(0)); + assertThat(results.getInt("totalFailedNumberOfModels"), is(0)); + assertThat(results.getInt("totalNotExecutedNumberOfModels"), is(0)); + assertThat(results.getInt("totalNumberOfUnvisitedVertices"), is(0)); + assertThat(results.getInt("totalNumberOfModels"), is(1)); + assertThat(results.getInt("totalCompletedNumberOfModels"), is(1)); + assertThat(results.getInt("totalNumberOfVisitedEdges"), is(1)); + assertThat(results.getInt("totalIncompleteNumberOfModels"), is(0)); + assertThat(results.getInt("totalNumberOfVisitedVertices"), is(2)); + assertThat(results.getInt("edgeCoverage"), is(100)); + assertThat(results.getInt("vertexCoverage"), is(100)); + assertThat(results.getInt("totalNumberOfUnvisitedEdges"), is(0)); } @GraphWalker(start = "throwException") @@ -249,7 +250,7 @@ public void multilpeContexts() throws IOException { contexts.get(3), contexts.get(4) ); - Assert.assertThat(executor.getMachine().getContexts().size(), is(5)); + assertThat(executor.getMachine().getContexts().size(), is(5)); } @Test diff --git a/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ContextCheckerTest.java b/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ContextCheckerTest.java index 7c4b86d1..292ed155 100644 --- a/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ContextCheckerTest.java +++ b/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ContextCheckerTest.java @@ -7,11 +7,11 @@ import org.graphwalker.core.model.Model; import org.graphwalker.core.model.Vertex; import org.graphwalker.io.factory.json.JsonContext; -import org.junit.Assert; import org.junit.Test; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; /** @@ -23,14 +23,14 @@ public class ContextCheckerTest { public void testDefault() { Context context = new JsonContext(); List issues = ContextChecker.hasIssues(context); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), is("No model found in context")); + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), is("No model found in context")); Model model = new Model(); context.setModel(model.build()); issues = ContextChecker.hasIssues(context); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), is("The model has neither a start element or a defined shared state.")); + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), is("The model has neither a start element or a defined shared state.")); Vertex v1 = new Vertex().setName("v1").setId("v1"); Vertex v2 = new Vertex().setName("v2").setId("v2"); @@ -38,7 +38,7 @@ public void testDefault() { context.setNextElement(v1); context.setModel(model.build()); issues = ContextChecker.hasIssues(context); - Assert.assertThat(issues.size(), is(0)); + assertThat(issues.size(), is(0)); } @Test @@ -59,8 +59,8 @@ public void testRandomGeneratorFullEdgeCoverageNonStronglyConnectedGraph() { context.setNextElement(context.getModel().findElements("e0").get(0)); List issues = ContextChecker.hasIssues(context); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), is("The model has multiple cul-de-sacs, and is requested to run using a random " + + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), is("The model has multiple cul-de-sacs, and is requested to run using a random " + "path generator and 100% edge coverage. That will not work.")); model.addEdge(new Edge().setSourceVertex(v4).setTargetVertex(v2).setName("e4").setId("e4")); @@ -69,8 +69,8 @@ public void testRandomGeneratorFullEdgeCoverageNonStronglyConnectedGraph() { context.setNextElement(context.getModel().findElements("e0").get(0)); issues = ContextChecker.hasIssues(context); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), is("The model has one cul-de-sacs, and is requested to run using a random " + + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), is("The model has one cul-de-sacs, and is requested to run using a random " + "path generator and 100% edge coverage. That might not work.")); } } diff --git a/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ContextsCheckerTest.java b/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ContextsCheckerTest.java index 0ec2c975..2906b5bc 100644 --- a/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ContextsCheckerTest.java +++ b/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ContextsCheckerTest.java @@ -2,13 +2,13 @@ import org.graphwalker.core.machine.Context; import org.graphwalker.io.factory.json.JsonContextFactory; -import org.junit.Assert; import org.junit.Test; import java.io.IOException; import java.nio.file.Paths; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; /** @@ -20,6 +20,6 @@ public class ContextsCheckerTest { public void testDefault() throws IOException { List contexts = new JsonContextFactory().create(Paths.get("json/petClinic.json")); List issues = ContextsChecker.hasIssues(contexts); - Assert.assertThat(issues.size(), is(0)); + assertThat(issues.size(), is(0)); } } diff --git a/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/EdgeCheckerTest.java b/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/EdgeCheckerTest.java index b368ea24..84ad3541 100644 --- a/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/EdgeCheckerTest.java +++ b/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/EdgeCheckerTest.java @@ -2,11 +2,11 @@ import org.graphwalker.core.model.Edge; import org.graphwalker.core.model.Vertex; -import org.junit.Assert; import org.junit.Test; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; /** @@ -17,22 +17,22 @@ public class EdgeCheckerTest { @Test public void testDefault() { List issues = EdgeChecker.hasIssues(new Edge().build()); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), is("Edge must have a target vertex.")); + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), is("Edge must have a target vertex.")); issues = EdgeChecker.hasIssues(new Edge().setTargetVertex(new Vertex()).build()); - Assert.assertThat(issues.size(), is(0)); + assertThat(issues.size(), is(0)); } @Test public void testName() { Edge edge = new Edge().setTargetVertex(new Vertex()); List issues = EdgeChecker.hasIssues(edge.setName("").build()); - Assert.assertThat(issues.size(), is(0)); + assertThat(issues.size(), is(0)); issues = EdgeChecker.hasIssues(edge.setName("spaces in name").build()); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), is("Name of edge cannot have any white spaces.")); + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), is("Name of edge cannot have any white spaces.")); } @Test @@ -40,11 +40,11 @@ public void testWeight() { Edge edge = new Edge().setTargetVertex(new Vertex()); edge.setWeight(-1.); List issues = EdgeChecker.hasIssues(edge.setName("").build()); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), is("The weight must be a value between 0 and 1.")); + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), is("The weight must be a value between 0 and 1.")); edge.setWeight(.5); issues = EdgeChecker.hasIssues(edge.setName("").build()); - Assert.assertThat(issues.size(), is(0)); + assertThat(issues.size(), is(0)); } } diff --git a/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ElementCheckerTest.java b/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ElementCheckerTest.java index 56781c65..84aa29df 100644 --- a/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ElementCheckerTest.java +++ b/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ElementCheckerTest.java @@ -4,11 +4,11 @@ import org.graphwalker.core.model.Edge; import org.graphwalker.core.model.Requirement; import org.graphwalker.core.model.Vertex; -import org.junit.Assert; import org.junit.Test; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; /** @@ -19,22 +19,22 @@ public class ElementCheckerTest { @Test public void testDefault() { List issues = ElementChecker.hasIssues(new Vertex().build()); - Assert.assertThat(issues.size(), is(0)); + assertThat(issues.size(), is(0)); } @Test public void testRequirement() { Vertex vertex = new Vertex().addRequirement(new Requirement("")); List issues = ElementChecker.hasIssues(vertex.build()); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), is("Requirement cannot be an empty string")); + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), is("Requirement cannot be an empty string")); } @Test public void testActions() { Edge edge = new Edge().addAction(new Action("")); List issues = ElementChecker.hasIssues(edge.build()); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), is("Script statement cannot be an empty string")); + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), is("Script statement cannot be an empty string")); } } diff --git a/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ModelCheckerTest.java b/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ModelCheckerTest.java index 0c6f71e2..efd5a791 100644 --- a/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ModelCheckerTest.java +++ b/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/ModelCheckerTest.java @@ -3,12 +3,12 @@ import org.graphwalker.core.model.Edge; import org.graphwalker.core.model.Model; import org.graphwalker.core.model.Vertex; -import org.junit.Assert; import org.junit.Test; import java.util.List; import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; /** @@ -19,7 +19,7 @@ public class ModelCheckerTest { @Test public void testDefault() { List issues = ModelChecker.hasIssues(new Model().build()); - Assert.assertThat(issues.size(), is(0)); + assertThat(issues.size(), is(0)); } @Test @@ -27,8 +27,8 @@ public void testInvalidElement() { Model model = new Model(); model.addVertex(new Vertex()); List issues = ModelChecker.hasIssues(model.build()); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), is("Name of vertex cannot be null")); + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), is("Name of vertex cannot be null")); } @Test @@ -37,8 +37,8 @@ public void testNotUniqueElementIds() { model.addVertex(new Vertex().setId("NOTUNIQUEID").setName("SomeName")); model.addVertex(new Vertex().setId("NOTUNIQUEID").setName("SomeOtherName")); List issues = ModelChecker.hasIssues(model.build()); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), is("Id of the vertex is not unique: NOTUNIQUEID")); + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), is("Id of the vertex is not unique: NOTUNIQUEID")); } @Test @@ -47,7 +47,7 @@ public void testUnnamedSelfLoop() { Vertex vertex = new Vertex().setName("SomeName").setId("SomeId"); model.addVertex(vertex).addEdge(new Edge().setSourceVertex(vertex).setTargetVertex(vertex)); List issues = ModelChecker.hasIssues(model.build()); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), containsString(", have a unnamed self loop edge.")); + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), containsString(", have a unnamed self loop edge.")); } } diff --git a/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/VertexCheckerTest.java b/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/VertexCheckerTest.java index 1cbb66f1..4eb1a068 100644 --- a/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/VertexCheckerTest.java +++ b/graphwalker-model-checker/src/test/java/org/graphwalker/modelchecker/VertexCheckerTest.java @@ -1,11 +1,11 @@ package org.graphwalker.modelchecker; import org.graphwalker.core.model.Vertex; -import org.junit.Assert; import org.junit.Test; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; /** @@ -16,22 +16,22 @@ public class VertexCheckerTest { @Test public void testDefault() { List issues = VertexChecker.hasIssues(new Vertex().build()); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), is("Name of vertex cannot be null")); + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), is("Name of vertex cannot be null")); issues = VertexChecker.hasIssues(new Vertex().setName("name").build()); - Assert.assertThat(issues.size(), is(0)); + assertThat(issues.size(), is(0)); } @Test public void testName() { Vertex vertex = new Vertex(); List issues = VertexChecker.hasIssues(vertex.setName("").build()); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), is("Name of vertex cannot be an empty string")); + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), is("Name of vertex cannot be an empty string")); issues = VertexChecker.hasIssues(vertex.setName("spaces in name").build()); - Assert.assertThat(issues.size(), is(1)); - Assert.assertThat(issues.get(0), is("Name of vertex cannot have any white spaces.")); + assertThat(issues.size(), is(1)); + assertThat(issues.get(0), is("Name of vertex cannot have any white spaces.")); } } diff --git a/graphwalker-restful/src/test/java/org/graphwalker/restful/RestTest.java b/graphwalker-restful/src/test/java/org/graphwalker/restful/RestTest.java index 37f1f3a3..2e074c71 100644 --- a/graphwalker-restful/src/test/java/org/graphwalker/restful/RestTest.java +++ b/graphwalker-restful/src/test/java/org/graphwalker/restful/RestTest.java @@ -44,7 +44,6 @@ import org.graphwalker.java.test.TestExecutionException; import org.graphwalker.java.test.TestExecutor; import org.json.JSONObject; -import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.slf4j.Logger; @@ -52,7 +51,9 @@ import java.io.IOException; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; +import static org.junit.Assert.*; /** * Created by krikar on 10/10/14. @@ -94,7 +95,7 @@ public void testRun() throws IOException { for (String error : e.getResult().getErrors()) { System.err.println(error); } - Assert.fail("Did not expect any errors"); + fail("Did not expect any errors"); } } } @@ -103,7 +104,7 @@ private CloseableHttpResponse httpExecute(HttpRequestBase request) { try { return HttpClientBuilder.create().build().execute(request); } catch (IOException e) { - Assert.fail(e.getMessage()); + fail(e.getMessage()); } return null; } @@ -120,8 +121,8 @@ public void e_SetData() { @Override public void v_EmptyMachine() { - Assert.assertNull(rest.getContexts()); - Assert.assertNull(rest.getMachine()); + assertNull(rest.getContexts()); + assertNull(rest.getMachine()); } @Override @@ -141,15 +142,15 @@ public void e_Restart() { @Override public void v_RestRunning() { - Assert.assertThat(response.getStatusLine().getStatusCode(), is(200)); + assertThat(response.getStatusLine().getStatusCode(), is(200)); String body = getResonseBody(); logger.debug(body); - Assert.assertThat(body, is("{\"result\":\"ok\"}")); - Assert.assertNotNull(rest.getContexts()); - Assert.assertNotNull(rest.getMachine()); + assertThat(body, is("{\"result\":\"ok\"}")); + assertNotNull(rest.getContexts()); + assertNotNull(rest.getMachine()); response = httpExecute(new HttpGet("http://localhost:9191/graphwalker/getStatistics")); - Assert.assertThat(response.getStatusLine().getStatusCode(), is(200)); + assertThat(response.getStatusLine().getStatusCode(), is(200)); body = getResonseBody(); logger.debug(body); JSONObject responseJSON = new JSONObject(body); @@ -180,29 +181,29 @@ public void e_HasNext() { @Override public void v_GetData() { - Assert.assertThat(response.getStatusLine().getStatusCode(), is(200)); + assertThat(response.getStatusLine().getStatusCode(), is(200)); String body = getResonseBody(); logger.debug(body); JSONObject responseJSON = new JSONObject(body); JSONAssert.assertEquals("Result should be ok", "{result:\"ok\"}", responseJSON, false); JSONAssert.assertEquals("Wrong value of num_of_books", "{data:{num_of_books:\"0\"}}", responseJSON, false); JSONAssert.assertEquals("Wrong value of MAX_BOOKS", "{data:{MAX_BOOKS:\"5\"}}", responseJSON, false); - Assert.assertNotNull(rest.getContexts()); - Assert.assertNotNull(rest.getMachine()); + assertNotNull(rest.getContexts()); + assertNotNull(rest.getMachine()); } private String getResonseBody() { try { return new BasicResponseHandler().handleResponse(response); } catch (IOException e) { - Assert.fail(e.getMessage()); + fail(e.getMessage()); } return null; } @Override public void v_GetNext() { - Assert.assertThat(response.getStatusLine().getStatusCode(), is(200)); + assertThat(response.getStatusLine().getStatusCode(), is(200)); String body = getResonseBody(); logger.debug(body); JSONObject responseJSON = new JSONObject(body); @@ -216,13 +217,13 @@ public void v_GetNext() { //JSONAssert.assertEquals("Wrong data", "{data:[{num_of_books:\"0\"},{MAX_BOOKS:\"5\"}]}", responseJSON, new ArraySizeComparator(JSONCompareMode.LENIENT)); JSONAssert.assertEquals("Wrong number of unvisited elements", "{numberOfUnvisitedElements:18}", responseJSON, false); - Assert.assertNotNull(rest.getContexts()); - Assert.assertNotNull(rest.getMachine()); + assertNotNull(rest.getContexts()); + assertNotNull(rest.getMachine()); } @Override public void v_GetStatistics() { - Assert.assertThat(response.getStatusLine().getStatusCode(), is(200)); + assertThat(response.getStatusLine().getStatusCode(), is(200)); String body = getResonseBody(); logger.debug(body); JSONObject responseJSON = new JSONObject(body); @@ -235,27 +236,27 @@ public void v_GetStatistics() { JSONAssert.assertEquals("Wrong number of unvisited vertices", "{totalNumberOfUnvisitedVertices:7}", responseJSON, false); JSONAssert.assertEquals("Wrong number of vertex coverage", "{vertexCoverage:0}", responseJSON, false); JSONAssert.assertEquals("Wrong number of unvisited edges", "{totalNumberOfUnvisitedEdges:11}", responseJSON, false); - Assert.assertNotNull(rest.getContexts()); - Assert.assertNotNull(rest.getMachine()); + assertNotNull(rest.getContexts()); + assertNotNull(rest.getMachine()); } @Override public void v_HasNext() { - Assert.assertThat(response.getStatusLine().getStatusCode(), is(200)); + assertThat(response.getStatusLine().getStatusCode(), is(200)); String body = getResonseBody(); logger.debug(body); - Assert.assertThat(body, is("{\"result\":\"ok\",\"hasNext\":\"true\"}")); - Assert.assertNotNull(rest.getContexts()); - Assert.assertNotNull(rest.getMachine()); + assertThat(body, is("{\"result\":\"ok\",\"hasNext\":\"true\"}")); + assertNotNull(rest.getContexts()); + assertNotNull(rest.getMachine()); } @Override public void v_SetData() { - Assert.assertThat(response.getStatusLine().getStatusCode(), is(200)); + assertThat(response.getStatusLine().getStatusCode(), is(200)); String body = getResonseBody(); logger.debug(body); - Assert.assertThat(body, is("{\"result\":\"ok\"}")); - Assert.assertNotNull(rest.getContexts()); - Assert.assertNotNull(rest.getMachine()); + assertThat(body, is("{\"result\":\"ok\"}")); + assertNotNull(rest.getContexts()); + assertNotNull(rest.getMachine()); } } diff --git a/graphwalker-websocket/src/test/java/org/graphwalker/websocket/WebSocketServerTest.java b/graphwalker-websocket/src/test/java/org/graphwalker/websocket/WebSocketServerTest.java index 89676140..63f35b53 100644 --- a/graphwalker-websocket/src/test/java/org/graphwalker/websocket/WebSocketServerTest.java +++ b/graphwalker-websocket/src/test/java/org/graphwalker/websocket/WebSocketServerTest.java @@ -34,7 +34,6 @@ import org.graphwalker.java.test.TestExecutor; import org.java_websocket.WebSocket; import org.json.JSONObject; -import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,7 +41,10 @@ import java.io.IOException; import java.nio.file.Paths; +import static com.ibm.icu.impl.Assert.fail; import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.*; /** * Created by krikar on 10/10/14. @@ -74,7 +76,7 @@ public void testRun() throws IOException { for (String error : e.getResult().getErrors()) { System.err.println(error); } - Assert.fail("Did not expect any errors"); + fail("Did not expect any errors"); } } } @@ -93,7 +95,7 @@ public void e_Connect() { @Override public void v_MachineRunning() { WebSocket socket = server.getSockets().iterator().next(); - Assert.assertNotNull(server.getMachines().get(socket)); + assertNotNull(server.getMachines().get(socket)); } @Override @@ -103,18 +105,18 @@ public void e_HasNext() { @Override public void v_EmptyMachine() { - Assert.assertThat("Before we connected, we should have no connections", numberOfConnections, is(0)); - Assert.assertThat("We should now haw 1 connection", server.getSockets().size(), is(1)); - Assert.assertThat(server.getMachines().size(), is(1)); + assertThat("Before we connected, we should have no connections", numberOfConnections, is(0)); + assertThat("We should now haw 1 connection", server.getSockets().size(), is(1)); + assertThat(server.getMachines().size(), is(1)); WebSocket socket = server.getSockets().iterator().next(); - Assert.assertNull(server.getMachines().get(socket)); + assertNull(server.getMachines().get(socket)); } @Override public void e_GetData() { String response = client.getData(); JSONObject jsonObject = new JSONObject(response); - Assert.assertEquals(expectedValue, jsonObject.getInt("value")); + assertEquals(expectedValue, jsonObject.getInt("value")); } @Override