mirror of
https://codeberg.org/PGPainless/wkd-java.git
synced 2024-12-22 05:37:58 +01:00
Introduce enum value for test case expectation to enable modelling of unassertive tests!
This commit is contained in:
parent
a91b6660bb
commit
40d5d6eba6
2 changed files with 21 additions and 7 deletions
|
@ -66,7 +66,7 @@ public class TestSuiteTestRunner {
|
|||
|
||||
if (testCase.isExpectSuccess()) {
|
||||
assertEquals(0, exitCode, testCase.getTestDescription());
|
||||
} else {
|
||||
} else if (testCase.isExpectFailure()) {
|
||||
assertNotEquals(0, exitCode, testCase.getTestDescription());
|
||||
}
|
||||
});
|
||||
|
|
|
@ -9,15 +9,21 @@ import java.nio.file.Path;
|
|||
|
||||
public class TestCase {
|
||||
|
||||
final boolean expectSuccess;
|
||||
enum Expectation {
|
||||
success,
|
||||
failure,
|
||||
unassertive
|
||||
}
|
||||
|
||||
final Expectation expectation;
|
||||
final String testTitle;
|
||||
final String testDescription;
|
||||
final String lookupMailAddress;
|
||||
final String certificatePath;
|
||||
final URI lookupUri;
|
||||
|
||||
public TestCase(boolean expectSuccess, String testTitle, String description, String lookupMailAddress, Path certificatePath, URI lookupUri) {
|
||||
this.expectSuccess = expectSuccess;
|
||||
public TestCase(Expectation expectation, String testTitle, String description, String lookupMailAddress, Path certificatePath, URI lookupUri) {
|
||||
this.expectation = expectation;
|
||||
this.testTitle = testTitle;
|
||||
this.testDescription = description;
|
||||
this.lookupMailAddress = lookupMailAddress;
|
||||
|
@ -28,17 +34,25 @@ public class TestCase {
|
|||
public static TestCase ok(String title, String description, String lookupMail, WkdDirectoryStructure structure) {
|
||||
Path filePath = structure.getRelativeCertificatePath(lookupMail);
|
||||
URI certUri = structure.getAddress(lookupMail);
|
||||
return new TestCase(true, title, description, lookupMail, filePath, certUri);
|
||||
return new TestCase(Expectation.success, title, description, lookupMail, filePath, certUri);
|
||||
}
|
||||
|
||||
public static TestCase fail(String title, String description, String lookupMail, WkdDirectoryStructure structure) {
|
||||
Path filePath = structure.getRelativeCertificatePath(lookupMail);
|
||||
URI certUri = structure.getAddress(lookupMail);
|
||||
return new TestCase(false, title, description, lookupMail, filePath, certUri);
|
||||
return new TestCase(Expectation.failure, title, description, lookupMail, filePath, certUri);
|
||||
}
|
||||
|
||||
public boolean isExpectSuccess() {
|
||||
return expectSuccess;
|
||||
return expectation == Expectation.success;
|
||||
}
|
||||
|
||||
public boolean isExpectFailure() {
|
||||
return expectation == Expectation.failure;
|
||||
}
|
||||
|
||||
public boolean isUnassertive() {
|
||||
return expectation == Expectation.unassertive;
|
||||
}
|
||||
|
||||
public String getTestTitle() {
|
||||
|
|
Loading…
Reference in a new issue