Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
10 changes: 5 additions & 5 deletions graphwalker-cli/src/test/java/org/graphwalker/cli/CheckTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)."));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()));
}

Expand All @@ -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() +
Expand All @@ -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(""));
}

/**
Expand All @@ -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()));
Expand All @@ -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()));
Expand All @@ -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()));
}

Expand All @@ -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\"}",
Expand All @@ -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\"}",
Expand All @@ -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\"}")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand All @@ -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(""));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand All @@ -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(""));
}

/**
Expand All @@ -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(""));
}

/**
Expand All @@ -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(""));
}

/**
Expand All @@ -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(""));
}

/**
Expand All @@ -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(""));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand All @@ -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]"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand All @@ -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: "));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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<String> 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",
Expand Down
Loading