Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
JENKINS-40963 Job DSL integration
test refactorings, namely use of matchers
- Loading branch information
Showing
with
59 additions
and 45 deletions.
- +3 −3 src/test/java/org/jenkinsci/plugins/liquibase/dsl/LiquibaseRunnerDslExtensionTest.java
- +1 −1 src/test/java/org/jenkinsci/plugins/liquibase/evaluator/ExecutedChangesetActionTest.java
- +20 −15 src/test/java/org/jenkinsci/plugins/liquibase/integration/ChangesetEvaluatorBuildResultTest.java
- +2 −2 src/test/java/org/jenkinsci/plugins/liquibase/integration/DriverSelectionFormTest.java
- +6 −6 src/test/java/org/jenkinsci/plugins/liquibase/integration/LiquibasePipelineTest.java
- +8 −6 src/test/java/org/jenkinsci/plugins/liquibase/integration/RollbackResultTest.java
- +13 −10 src/test/java/org/jenkinsci/plugins/liquibase/matchers/BuildResultMatcher.java
- +1 −1 src/test/java/org/jenkinsci/plugins/liquibase/{integration → matchers}/InputCheckedMatcher.java
- +1 −1 src/test/java/org/jenkinsci/plugins/liquibase/{integration → matchers}/IsChangeSetDetail.java
- +4 −0 src/test/java/org/jenkinsci/plugins/liquibase/matchers/ProjectWithName.java
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -1,40 +1,43 @@ | ||
package org.jenkinsci.plugins.liquibase.matchers; | ||
|
||
import hudson.model.Result; | ||
import hudson.model.Run; | ||
|
||
import org.hamcrest.Description; | ||
import org.hamcrest.TypeSafeMatcher; | ||
|
||
public class BuildResultMatcher extends TypeSafeMatcher<Run> { | ||
|
||
private Result expectedResult; | ||
|
||
public BuildResultMatcher(Result expectedResult) { | ||
this.expectedResult = expectedResult; | ||
} | ||
|
||
public static BuildResultMatcher isSuccessful() { | ||
return new BuildResultMatcher(Result.SUCCESS); | ||
} | ||
|
||
public static BuildResultMatcher isUnstable() { | ||
return new BuildResultMatcher(Result.UNSTABLE); | ||
} | ||
public static BuildResultMatcher isFailure() { | ||
return new BuildResultMatcher(Result.FAILURE); | ||
} | ||
|
||
@Override | ||
protected boolean matchesSafely(Run item) { | ||
return item.getResult().equals(expectedResult); | ||
} | ||
|
||
@Override | ||
protected void describeMismatchSafely(Run item, Description mismatchDescription) { | ||
mismatchDescription.appendText("build whose result was ").appendValue(item.getResult().toString()); | ||
} | ||
|
||
@Override | ||
public void describeTo(Description description) { | ||
description.appendText("build whose result is ").appendValue(expectedResult.toString()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -1,4 +1,4 @@ | ||
package org.jenkinsci.plugins.liquibase.matchers; | ||
|
||
import org.hamcrest.Description; | ||
import org.hamcrest.TypeSafeMatcher; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -1,4 +1,4 @@ | ||
package org.jenkinsci.plugins.liquibase.matchers; | ||
|
||
import org.hamcrest.Description; | ||
import org.hamcrest.Matcher; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters