@Test
  public void setWorkingDirectoryToExistingFileThrowsIllegalArgumentException() throws IOException {
    // given: a file instead of a directory
    File nonDirectory = temporaryFolder.newFile();

    // when: setting WorkingDirectory to that file
    Throwable thrown = catchThrowable(() -> new Builder()
        .setWorkingDirectory(nonDirectory.getCanonicalPath()));

    // then: throw IllegalArgumentException
    then(thrown)
        .isExactlyInstanceOf(IllegalArgumentException.class)
        .hasMessage(workingDirectoryNotFoundErrorMessage())
        .hasCause(new FileNotFoundException(nonDirectory.getCanonicalPath()));
  }
Integration tests for using {@link ServerLauncher} as an in-process API within an existing JVM.
geode-core/src/integrationTest/java/org/apache/geode/distributed/ServerLauncherBuilderIntegrationTest.java