use of org.junit.platform.commons.util.PreconditionViolationException in project junit5 by junit-team.
the class CsvFileArgumentsProviderTests method throwsExceptionForMissingClasspathResource.
@Test
void throwsExceptionForMissingClasspathResource() {
CsvFileSource annotation = annotation("UTF-8", "\n", ',', "does-not-exist.csv");
PreconditionViolationException exception = assertThrows(PreconditionViolationException.class, () -> provide(new CsvFileArgumentsProvider(), annotation).toArray());
assertThat(exception).hasMessageContaining("Classpath resource does not exist: does-not-exist.csv");
}
use of org.junit.platform.commons.util.PreconditionViolationException in project junit5 by junit-team.
the class MethodArgumentsProviderTests method throwsExceptionWhenNoTestClassIsAvailable.
@Test
void throwsExceptionWhenNoTestClassIsAvailable() {
PreconditionViolationException exception = assertThrows(PreconditionViolationException.class, () -> provideArguments((Class<?>) null, null, false, "someMethod"));
assertThat(exception).hasMessageContaining("required test class is not present");
}
use of org.junit.platform.commons.util.PreconditionViolationException in project junit5 by junit-team.
the class MethodArgumentsProviderTests method throwsExceptionForIllegalReturnType.
@Test
void throwsExceptionForIllegalReturnType() {
PreconditionViolationException exception = assertThrows(PreconditionViolationException.class, () -> provideArguments("providerWithIllegalReturnType").toArray());
assertThat(exception).hasMessageContaining("Cannot convert instance of java.lang.Integer into a Stream");
}
use of org.junit.platform.commons.util.PreconditionViolationException in project junit5 by junit-team.
the class ValueArgumentsProviderTests method onlyEmptyInputsAreNotAllowed.
@Test
void onlyEmptyInputsAreNotAllowed() {
PreconditionViolationException exception = assertThrows(PreconditionViolationException.class, () -> provideArguments(new short[0], new byte[0], new int[0], new long[0], new float[0], new double[0], new char[0], new String[0], new Class<?>[0]));
assertThat(exception).hasMessageContaining("Exactly one type of input must be provided in the @ValueSource annotation, but there were 0");
}
use of org.junit.platform.commons.util.PreconditionViolationException in project junit5 by junit-team.
the class TagFilterTests method assertSyntaxViolationForIncludes.
private void assertSyntaxViolationForIncludes(String tag) {
PreconditionViolationException exception = assertThrows(PreconditionViolationException.class, () -> includeTags(tag));
assertThat(exception).hasMessageStartingWith("Unable to parse tag expression");
}
Aggregations