Skip to content

Commit

Permalink
[#18] Enhanced some unit tests for FluentElementValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasstamann committed Apr 15, 2018
1 parent f4895e9 commit 7ad11e6
Showing 1 changed file with 104 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,110 @@ protected void testCase(TypeElement element) {
.build()


},
{
"validate Exclusive Characteristics Element based validator - none of",
AnnotationProcessorUnitTestConfigurationBuilder.createTestConfig()
.compilationShouldFail()
.setProcessor(new AbstractUnitTestAnnotationProcessorClass() {
@Override
protected void testCase(TypeElement element) {

MatcherAssert.assertThat(
FluentElementValidator.createFluentElementValidator(element)
.error().applyValidator(TestCoreMatcherFactory.createElementBasedExclusiveCriteriaCoreMatcher(String.class, "SUCCESS", false, false)).hasNoneOf("XX", "YY").validateAndIssueMessages()
, Matchers.equalTo(true));

FluentElementValidator.createFluentElementValidator(element)
.error().applyValidator(TestCoreMatcherFactory.createElementBasedExclusiveCriteriaCoreMatcher(String.class, "FAILURE", false, true)).hasNoneOf("XX", "YY").validateAndIssueMessages();

}
}
)
.addMessageValidator()
.setErrorChecks("FAILURE")
.finishMessageValidator()
.build()


},
{
"validate Exclusive Characteristics validator - none of",
AnnotationProcessorUnitTestConfigurationBuilder.createTestConfig()
.compilationShouldFail()
.setProcessor(new AbstractUnitTestAnnotationProcessorClass() {
@Override
protected void testCase(TypeElement element) {

MatcherAssert.assertThat(
FluentElementValidator.createFluentElementValidator(element)
.error().applyValidator(TestCoreMatcherFactory.createExclusiveCriteriaCoreMatcher(TypeElement.class, String.class, "SUCCESS", false, false)).hasNoneOf("XX", "YY").validateAndIssueMessages()
, Matchers.equalTo(true));

FluentElementValidator.createFluentElementValidator(element)
.error().applyValidator(TestCoreMatcherFactory.createExclusiveCriteriaCoreMatcher(TypeElement.class, String.class, "FAILURE", false, true)).hasNoneOf("XX", "YY").validateAndIssueMessages();

}
}
)
.addMessageValidator()
.setErrorChecks("FAILURE")
.finishMessageValidator()
.build()


},
{
"validate Exclusive Characteristics Element based validator - one of",
AnnotationProcessorUnitTestConfigurationBuilder.createTestConfig()
.compilationShouldFail()
.setProcessor(new AbstractUnitTestAnnotationProcessorClass() {
@Override
protected void testCase(TypeElement element) {

MatcherAssert.assertThat(
FluentElementValidator.createFluentElementValidator(element)
.error().applyValidator(TestCoreMatcherFactory.createElementBasedExclusiveCriteriaCoreMatcher(String.class, "SUCCESS", false, true)).hasOneOf("XX", "YY").validateAndIssueMessages()
, Matchers.equalTo(true));

FluentElementValidator.createFluentElementValidator(element)
.error().applyValidator(TestCoreMatcherFactory.createElementBasedExclusiveCriteriaCoreMatcher(String.class, "FAILURE", true, true)).hasOneOf("XX", "YY").validateAndIssueMessages();

}
}
)
.addMessageValidator()
.setErrorChecks("FAILURE")
.finishMessageValidator()
.build()


},
{
"validate Exclusive Characteristics validator - one of",
AnnotationProcessorUnitTestConfigurationBuilder.createTestConfig()
.compilationShouldFail()
.setProcessor(new AbstractUnitTestAnnotationProcessorClass() {
@Override
protected void testCase(TypeElement element) {

MatcherAssert.assertThat(
FluentElementValidator.createFluentElementValidator(element)
.error().applyValidator(TestCoreMatcherFactory.createExclusiveCriteriaCoreMatcher(TypeElement.class, String.class, "SUCCESS", false, true)).hasOneOf("XX", "YY").validateAndIssueMessages()
, Matchers.equalTo(true));

FluentElementValidator.createFluentElementValidator(element)
.error().applyValidator(TestCoreMatcherFactory.createExclusiveCriteriaCoreMatcher(TypeElement.class, String.class, "FAILURE", true, true)).hasOneOf("XX", "YY").validateAndIssueMessages();

}
}
)
.addMessageValidator()
.setErrorChecks("FAILURE")
.finishMessageValidator()
.build()


},
{
"validate IS Element based validator",
Expand Down

0 comments on commit 7ad11e6

Please sign in to comment.