Skip to content

Commit

Permalink
Add test for classpath with wildcards resetting environment multiple …
Browse files Browse the repository at this point in the history
…times (#5760)
  • Loading branch information
jpallas authored and scottdraves committed Jul 30, 2017
1 parent 2d1a1e2 commit 95bf86f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@
public class ClasspathMagicCommandTest {

private static final String SRC_TEST_RESOURCES = "./src/test/resources/";
private static final String CLASSPATH_TO_JAR = "../../doc/contents/demoResources/BeakerXClasspathTest.jar";
private static final String CLASSPATH_TO_JAR = SRC_TEST_RESOURCES + "dirWithTwoJars/foo.jar";
private MagicCommand sut;
private KernelTest kernel;
private EvaluatorTest evaluator;

@Before
public void setUp() throws Exception {
this.kernel = new KernelTest("id2", new EvaluatorTest());
this.evaluator = new EvaluatorTest();
this.kernel = new KernelTest("id2", evaluator);
this.sut = new MagicCommand(kernel);
}

Expand All @@ -55,6 +57,19 @@ public void handleClasspathAddJarMagicCommand() throws Exception {
assertThat(kernel.getClasspath().get(0)).isEqualTo(CLASSPATH_TO_JAR);
}

@Test
public void handleClasspathAddJarWildcardMagicCommand() throws Exception {
//given
String codeAsString = "" +
"%classpath add jar " + SRC_TEST_RESOURCES + "dirWithTwoJars/*";
Code code = new Code(codeAsString);
//when
MagicCommandResult result = sut.process(code, new Message(), 1);
//then
assertThat(classpath(result)).contains("foo.jar", "bar.jar");
assertThat(evaluator.getResetEnvironmentCounter()).isEqualTo(1);
}

@Test
public void shouldCreateMsgWithWrongMagic() throws Exception {
//given
Expand Down
Empty file.
Empty file.

0 comments on commit 95bf86f

Please sign in to comment.