Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skipping tests properly if "gl2.integration.tests" property is not set.
- Loading branch information
1 parent
93eeadb
commit 9d7a180
Showing
5 changed files
with
41 additions
and
18 deletions.
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
17 changes: 17 additions & 0 deletions
17
integration-tests/src/test/java/integration/IgnoreStatement.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package integration; | ||
|
||
import org.junit.Assume; | ||
import org.junit.runners.model.Statement; | ||
|
||
class IgnoreStatement extends Statement { | ||
private final String message; | ||
|
||
public IgnoreStatement(String message) { | ||
this.message = message; | ||
} | ||
|
||
@Override | ||
public void evaluate() throws Throwable { | ||
Assume.assumeTrue(this.message, false); | ||
} | ||
} |
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
23 changes: 23 additions & 0 deletions
23
integration-tests/src/test/java/integration/RunIfProperty.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package integration; | ||
|
||
import org.junit.rules.TestRule; | ||
import org.junit.runner.Description; | ||
import org.junit.runners.model.Statement; | ||
|
||
public class RunIfProperty implements TestRule { | ||
private final String propertyName; | ||
|
||
public RunIfProperty(String propertyName) { | ||
this.propertyName = propertyName; | ||
} | ||
|
||
@Override | ||
public Statement apply(Statement base, Description description) { | ||
final String propertyValue = System.getProperty(this.propertyName); | ||
if (propertyValue == null || !Boolean.valueOf(propertyValue)) { | ||
return new IgnoreStatement("Not running REST API integration tests. Add -Dgl2.integration.tests to run them."); | ||
} else { | ||
return base; | ||
} | ||
} | ||
} |