Skip to content

Commit

Permalink
[JENKINS-33382] Add new test and static import hamcrests method
Browse files Browse the repository at this point in the history
  • Loading branch information
armfergom committed Mar 31, 2016
1 parent bf380a9 commit 3e340c1
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/test/java/plugins/MSBuildPluginTest.java
@@ -1,8 +1,9 @@
package plugins;

import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.not;

import org.hamcrest.Matchers;
import org.jenkinsci.test.acceptance.junit.AbstractJUnitTest;
import org.jenkinsci.test.acceptance.junit.Native;
import org.jenkinsci.test.acceptance.junit.WithOS;
Expand Down Expand Up @@ -56,8 +57,19 @@ public void buildProjNoCmdLineArgumentsTest() {
// Job should run successfully
Build b = job.scheduleBuild();
b.shouldSucceed();
assertThat(b.getConsole(), Matchers.containsString("Build succeeded."));
assertThat(b.getConsole(), Matchers.not(Matchers.containsString("Done building project \"project.proj\".")));
assertThat(b.getConsole(), containsString("Build succeeded."));
assertThat(b.getConsole(), not(containsString("Done building project \"project.proj\".")));
}

@Test
public void buildWithDefaultProjTest() {
FreeStyleJob job = msBuildJob("/msbuild_plugin/projProject/", "", null);

// Job should run successfully
Build b = job.scheduleBuild();
b.shouldSucceed();
assertThat(b.getConsole(), containsString("Build succeeded."));
assertThat(b.getConsole(), not(containsString("Done building project \"project.proj\".")));
}

@Test
Expand All @@ -68,8 +80,8 @@ public void buildProjCmdLineArgumentsTest() {
Build b = job.scheduleBuild();
b.shouldSucceed();
String console = b.getConsole();
assertThat(console, Matchers.containsString("Build succeeded."));
assertThat(console, Matchers.containsString("Done Building Project"));
assertThat(console, containsString("Build succeeded."));
assertThat(console, containsString("Done Building Project"));
}

@Test
Expand All @@ -79,7 +91,7 @@ public void buildSlnNoCmdLineArgumentsTest() {
// Job should run successfully
Build b = job.scheduleBuild();
b.shouldSucceed();
assertThat(b.getConsole(), Matchers.containsString("Build succeeded."));
assertThat(b.getConsole(), containsString("Build succeeded."));
}

@Test
Expand All @@ -90,7 +102,7 @@ public void buildSlnCmdLineArgumentsTest() {
Build b = job.scheduleBuild();
b.shouldSucceed();
String console = b.getConsole();
assertThat(console, Matchers.containsString("Build succeeded."));
assertThat(console, Matchers.containsString("Done Building Project"));
assertThat(console, containsString("Build succeeded."));
assertThat(console, containsString("Done Building Project"));
}
}

0 comments on commit 3e340c1

Please sign in to comment.