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

The following examples show how to use org.junit.jupiter.api.condition.EnabledForJreRange. 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: BufferUtilTest.java    From agrona with Apache License 2.0 5 votes vote down vote up
@Test
@EnabledForJreRange(min = JAVA_9)
public void freeThrowsIllegalArgumentExceptionIfByteBufferIsASlice()
{
    final ByteBuffer buffer = ByteBuffer.allocateDirect(4).slice();

    assertThrows(IllegalArgumentException.class, () -> BufferUtil.free(buffer));
}
 
Example #2
Source File: BufferUtilTest.java    From agrona with Apache License 2.0 5 votes vote down vote up
@Test
@EnabledForJreRange(min = JAVA_9)
public void freeThrowsIllegalArgumentExceptionIfByteBufferIsADuplicate()
{
    final ByteBuffer buffer = ByteBuffer.allocateDirect(4).duplicate();

    assertThrows(IllegalArgumentException.class, () -> BufferUtil.free(buffer));
}
 
Example #3
Source File: JarRunnerIT.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Test
@EnabledForJreRange(min = JRE.JAVA_11)
public void testThatAppCDSAreUsable() throws Exception {
    File testDir = initProject("projects/classic", "projects/project-classic-console-output-appcds");
    RunningInvoker running = new RunningInvoker(testDir, false);

    MavenProcessInvocationResult result = running
            .execute(Arrays.asList("package", "-DskipTests", "-Dquarkus.package.create-appcds=true"),
                    Collections.emptyMap());

    await().atMost(1, TimeUnit.MINUTES).until(() -> result.getProcess() != null && !result.getProcess().isAlive());
    assertThat(running.log()).containsIgnoringCase("BUILD SUCCESS");
    running.stop();

    Path jar = testDir.toPath().toAbsolutePath()
            .resolve(Paths.get("target/acme-1.0-SNAPSHOT-runner.jar"));
    File output = new File(testDir, "target/output.log");
    output.createNewFile();

    // by using '-Xshare:on' we ensure that the JVM will fail if for any reason is cannot use the AppCDS
    // '-Xlog:class+path=info' will print diagnostic information that is useful for debugging if something goes wrong
    Process process = doLaunch(jar.getFileName(), output,
            Arrays.asList("-XX:SharedArchiveFile=app-cds.jsa", "-Xshare:on", "-Xlog:class+path=info"))
                    .directory(jar.getParent().toFile()).start();
    try {
        // Wait until server up
        dumpFileContentOnFailure(() -> {
            await()
                    .pollDelay(1, TimeUnit.SECONDS)
                    .atMost(1, TimeUnit.MINUTES).until(() -> DevModeTestUtils.getHttpResponse("/app/hello/package", 200));
            return null;
        }, output, ConditionTimeoutException.class);

        String logs = FileUtils.readFileToString(output, "UTF-8");

        assertThatOutputWorksCorrectly(logs);
    } finally {
        process.destroy();
    }

}
 
Example #4
Source File: ChecksumsTest.java    From aeron with Apache License 2.0 4 votes vote down vote up
@EnabledForJreRange(min = JAVA_9)
@Test
void crc32c()
{
    assertSame(Crc32c.INSTANCE, Checksums.crc32c());
}
 
Example #5
Source File: ChecksumsTest.java    From aeron with Apache License 2.0 4 votes vote down vote up
@EnabledForJreRange(min = JAVA_9)
@Test
void newInstanceReturnsSameInstanceOfCrc32c()
{
    assertSame(Crc32c.INSTANCE, Checksums.newInstance(Crc32c.class.getName()));
}