@Test
  public void findsCorrectFileByName() throws Exception {
    // arrange
    FileUtils.writeStringToFile(pidFile, String.valueOf(pid), Charset.defaultCharset());
    int[] pids = new AvailablePid().findAvailablePids(4);
    for (int i = 1; i <= pids.length; i++) {
      FileUtils.writeStringToFile(
          new File(directory, "pid" + i + ".txt"), String.valueOf(pids[i - 1]),
          Charset.defaultCharset());
    }
    assertThat(directory.listFiles()).hasSize(pids.length + 1);

    // act
    PidFile namedPidFile = new PidFile(directory, pidFile.getName());

    // assert
    assertThat(namedPidFile.getFile()).hasContent(String.valueOf(pid));
    assertThat(namedPidFile.readPid()).isEqualTo(pid);
  }
Functional integration tests for {@link PidFile}.

@since GemFire 8.2
geode-core/src/integrationTest/java/org/apache/geode/internal/process/PidFileIntegrationTest.java