org.junit.jupiter.api.condition.EnabledOnJre Java Examples

The following examples show how to use org.junit.jupiter.api.condition.EnabledOnJre. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RuleToXmlConverterTest.java    From yare with MIT License 6 votes vote down vote up
@Test
@EnabledOnJre(JRE.JAVA_8)
void shouldThrowExceptionWhenXmlRuleDoesNotSatisfySchemaOnJdk8() {
    // given
    String invalidXmlRule = "" +
            "<yare:Rule xmlns:yare=\"http://www.sabre.com/schema/oss/yare/rules/v1\">\n" +
            "    <yare:unexpectedElement/>\n" +
            "</yare:Rule>";

    // when / then
    assertThatThrownBy(() -> converter.unmarshal(invalidXmlRule))
            .isInstanceOf(SchemaValidationException.class)
            .hasMessage("Given XML rule does not satisfy schema. Errors:\n" +
                    "Line: 2. Column: 30. " +
                    "Error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'yare:unexpectedElement'. " +
                    "One of '{\"http://www.sabre.com/schema/oss/yare/rules/v1\":Attribute, " +
                    "\"http://www.sabre.com/schema/oss/yare/rules/v1\":Fact, " +
                    "\"http://www.sabre.com/schema/oss/yare/rules/v1\":Predicate}' " +
                    "is expected.");
}
 
Example #2
Source File: PidTests.java    From embedded-cassandra with Apache License 2.0 5 votes vote down vote up
@Test
@EnabledOnJre(JRE.JAVA_8)
@EnabledOnOs(OS.WINDOWS)
void constructProcessIdWindowsJava8() throws IOException {
	Process process = new ProcessBuilder("echo", "Hello world").start();
	assertThat(Pid.get(process)).isEqualTo(-1);
}
 
Example #3
Source File: JavaVersionTestsDemo.java    From spring-boot-tutorial with Creative Commons Attribution Share Alike 4.0 International 4 votes vote down vote up
@Test
@EnabledOnJre({ JAVA_9, JAVA_10 })
void onJava9Or10() {
    System.out.println("JAVA9, JAVA10 TEST");
}
 
Example #4
Source File: JavaVersionTestsDemo.java    From spring-boot-tutorial with Creative Commons Attribution Share Alike 4.0 International 4 votes vote down vote up
@Test
@EnabledOnJre(JAVA_8)
void onlyOnJava8() {
    System.out.println("JAVA8 TEST");
}
 
Example #5
Source File: RDFFactoryTest.java    From trellis with Apache License 2.0 4 votes vote down vote up
@Test
@EnabledOnJre(JAVA_8)
void testGetService() {
    assertTrue(RDFFactory.findFirst(RDF.class).isPresent());
    assertFalse(RDFFactory.findFirst(String.class).isPresent());
}
 
Example #6
Source File: DBUtilsTest.java    From trellis with Apache License 2.0 4 votes vote down vote up
@Test
@EnabledOnJre(JAVA_8)
void testFindFirst() {
    assertTrue(DBUtils.findFirst(RDF.class).isPresent());
    assertFalse(DBUtils.findFirst(LDP.class).isPresent());
}
 
Example #7
Source File: DisabledTests.java    From journaldev with MIT License 4 votes vote down vote up
@Test
@EnabledOnJre(value = JRE.JAVA_10)
void test5() {
	assertTrue(System.getProperty("java.version").startsWith("10"));
}
 
Example #8
Source File: ChecksumsTest.java    From aeron with Apache License 2.0 4 votes vote down vote up
@EnabledOnJre(JAVA_8)
@Test
void crc32cThrowsIllegalStateExceptionIfCalledOnJdk8()
{
    assertThrows(IllegalStateException.class, Checksums::crc32c);
}
 
Example #9
Source File: ChecksumsTest.java    From aeron with Apache License 2.0 4 votes vote down vote up
@EnabledOnJre(JAVA_8)
@Test
void newInstanceThrowsIllegalStateExceptionIfCalledWithCrc32cOnJdk8()
{
    assertThrows(IllegalStateException.class, () -> Checksums.newInstance(Crc32c.class.getName()));
}