Java Code Examples for org.junit.jupiter.api.condition.OS#MAC

The following examples show how to use org.junit.jupiter.api.condition.OS#MAC . 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: ConfigurationTest.java    From benchmarks with Apache License 2.0 6 votes vote down vote up
@Test
@EnabledOnOs({ OS.LINUX, OS.MAC })
void throwsIllegalArgumentExceptionIfOutputDirectoryIsNotWriteable(final @TempDir Path tempDir) throws IOException
{
    final Path outputDirectory = Files.createDirectory(tempDir.resolve("read-only"),
        PosixFilePermissions.asFileAttribute(EnumSet.of(PosixFilePermission.OWNER_READ)));

    final Builder builder = new Builder()
        .numberOfMessages(4)
        .messageTransceiverClass(InMemoryMessageTransceiver.class)
        .outputDirectory(outputDirectory);

    final IllegalArgumentException ex = assertThrows(IllegalArgumentException.class, builder::build);

    assertEquals("output directory is not writeable: " + outputDirectory, ex.getMessage());
}
 
Example 2
Source File: ConfigurationTest.java    From benchmarks with Apache License 2.0 6 votes vote down vote up
@Test
@EnabledOnOs({ OS.LINUX, OS.MAC })
void throwsIllegalArgumentExceptionIfOutputDirectoryCannotBeCreated(final @TempDir Path tempDir) throws IOException
{
    final Path rootDirectory = Files.createDirectory(tempDir.resolve("read-only"),
        PosixFilePermissions.asFileAttribute(EnumSet.of(PosixFilePermission.OWNER_READ)));
    final Path outputDirectory = rootDirectory.resolve("actual-dir");

    final Builder builder = new Builder()
        .numberOfMessages(4)
        .messageTransceiverClass(InMemoryMessageTransceiver.class)
        .outputDirectory(outputDirectory);

    final IllegalArgumentException ex = assertThrows(IllegalArgumentException.class, builder::build);

    assertEquals("failed to create output directory: " + outputDirectory, ex.getMessage());
}
 
Example 3
Source File: NativeLibraryTest.java    From darklaf with MIT License 5 votes vote down vote up
@Test
@EnabledOnOs(OS.MAC)
public void testMacOSLibraryLoading() {
    MacOSLibrary library = new TestMacOsLibrary();
    Assertions.assertNotNull(getClass().getResource(library.getLibraryPath()),
                             "macOS library doesn't exist");
    Assertions.assertDoesNotThrow(library::updateLibrary);
    Assertions.assertTrue(library.isLoaded(), "MacOS library isn't loaded");
}
 
Example 4
Source File: SystemMetricsTest.java    From apm-agent-java with Apache License 2.0 5 votes vote down vote up
@Test
@DisabledOnOs(OS.MAC)
void testSystemMetrics() throws InterruptedException {
    systemMetrics.bindTo(metricRegistry);
    // makes sure system.cpu.total.norm.pct does not return NaN
    consumeCpu();
    Thread.sleep(1000);
    assertThat(metricRegistry.getGaugeValue("system.cpu.total.norm.pct", Labels.EMPTY)).isBetween(0.0, 1.0);
    assertThat(metricRegistry.getGaugeValue("system.process.cpu.total.norm.pct", Labels.EMPTY)).isBetween(0.0, 1.0);
    assertThat(metricRegistry.getGaugeValue("system.memory.total", Labels.EMPTY)).isGreaterThan(0.0);
    assertThat(metricRegistry.getGaugeValue("system.memory.actual.free", Labels.EMPTY)).isGreaterThan(0.0);
    assertThat(metricRegistry.getGaugeValue("system.process.memory.size", Labels.EMPTY)).isGreaterThan(0.0);
}
 
Example 5
Source File: ShellTaskTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Test
@Deployment
@EnabledOnOs(OS.MAC)
public void testEchoShellMac() {
    if (osType == OsType.MAC) {

        ProcessInstance pi = runtimeService.startProcessInstanceByKey("echoShellMac");

        String st = (String) runtimeService.getVariable(pi.getId(), "resultVar");
        assertThat(st).isNotNull();
        assertThat(st).startsWith("EchoTest");
    }
}
 
Example 6
Source File: DefaultLocalDriverProviderTest.java    From webdriver-factory with Apache License 2.0 5 votes vote down vote up
@Test
@EnabledOnOs(OS.MAC)
@DisabledIfEnvironmentVariable(named = "CI", matches = "true")
void canInstantiateSafariDriverWithSafariOptions() {
  driver = provider.createDriver(new SafariOptions());
  assertTrue(driver instanceof SafariDriver);
}
 
Example 7
Source File: DisabledTests.java    From journaldev with MIT License 4 votes vote down vote up
@Test
@DisabledOnOs(value = { OS.MAC, OS.WINDOWS })
void test2() {
	assertFalse(3 < 0);
}
 
Example 8
Source File: DisabledTests.java    From journaldev with MIT License 4 votes vote down vote up
@Test
@EnabledOnOs(value = { OS.MAC })
void test3() {
	assertTrue(System.getProperty("os.name").startsWith("Mac"));
}