Search in sources :

Example 16 with PreconditionViolationException

use of org.junit.platform.commons.util.PreconditionViolationException in project junit5 by junit-team.

the class TestTagTests method assertSyntaxViolation.

private void assertSyntaxViolation(String tag) {
    PreconditionViolationException exception = assertThrows(PreconditionViolationException.class, () -> TestTag.create(tag));
    assertThat(exception).hasMessageStartingWith("Tag name");
    assertThat(exception).hasMessageEndingWith("must be syntactically valid");
}
Also used : PreconditionViolationException(org.junit.platform.commons.util.PreconditionViolationException)

Example 17 with PreconditionViolationException

use of org.junit.platform.commons.util.PreconditionViolationException in project junit5 by junit-team.

the class TestInstanceLifecycleUtilsTests method getDefaultTestInstanceLifecyclePreconditions.

@Test
void getDefaultTestInstanceLifecyclePreconditions() {
    PreconditionViolationException exception = assertThrows(PreconditionViolationException.class, () -> getDefaultTestInstanceLifecycle(null));
    assertThat(exception).hasMessage("ConfigurationParameters must not be null");
}
Also used : PreconditionViolationException(org.junit.platform.commons.util.PreconditionViolationException) Test(org.junit.jupiter.api.Test)

Example 18 with PreconditionViolationException

use of org.junit.platform.commons.util.PreconditionViolationException in project junit5 by junit-team.

the class AbstractTestRuleAdapterTests method constructionWithUnassignableArgumentsFails.

@Test
void constructionWithUnassignableArgumentsFails() {
    PreconditionViolationException exception = assertThrows(PreconditionViolationException.class, () -> new TestableTestRuleAdapter(new SimpleRuleAnnotatedMember(new TemporaryFolder()), Verifier.class));
    assertEquals(exception.getMessage(), "class org.junit.rules.Verifier is not assignable from class org.junit.rules.TemporaryFolder");
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) Verifier(org.junit.rules.Verifier) PreconditionViolationException(org.junit.platform.commons.util.PreconditionViolationException) Test(org.junit.jupiter.api.Test)

Aggregations

PreconditionViolationException (org.junit.platform.commons.util.PreconditionViolationException)18 Test (org.junit.jupiter.api.Test)12 DemoHierarchicalTestEngine (org.junit.platform.engine.support.hierarchical.DemoHierarchicalTestEngine)3 IOException (java.io.IOException)2 TestExecutionListener (org.junit.platform.launcher.TestExecutionListener)2 TemporaryFolder (org.junit.rules.TemporaryFolder)1 Verifier (org.junit.rules.Verifier)1