### Question:
ChromeLauncher implements AutoCloseable { public int exitValue() { if (chromeProcess == null) { throw new IllegalStateException("Chrome process has not been started started."); } return chromeProcess.exitValue(); } ChromeLauncher();  ChromeLauncher(ChromeLauncherConfiguration configuration);  ChromeLauncher(
      ProcessLauncher processLauncher,
      Environment environment,
      ShutdownHookRegistry shutdownHookRegistry,
      ChromeLauncherConfiguration configuration); ChromeService launch(Path chromeBinaryPath, ChromeArguments chromeArguments); ChromeService launch(ChromeArguments chromeArguments); ChromeService launch(boolean headless); ChromeService launch(); Path getChromeBinaryPath(); @Override void close(); int exitValue(); boolean isAlive(); static final String ENV_CHROME_PATH; }### Answer:
@Test(expected = IllegalStateException.class) public void testExitValueThrowsExceptionWhenProcessNotStarted() throws IOException { launcher.exitValue(); }
@Test public void testExitValue() throws IOException { final Path binaryPath = Paths.get("test-binary-path"); final ChromeArguments chromeArguments = ChromeArguments.builder().incognito().userDataDir("user-data-dir-param").build(); shutdownHookRegistry.register(anyObject()); final String trigger = "\r\n\r\nDevTools listening on ws: expect(process.getInputStream()).andReturn(new ByteArrayInputStream(trigger.getBytes())); expect(process.exitValue()).andReturn(123); Capture<List<String>> captureArguments = Capture.newInstance(); expect(processLauncher.launch(eq("test-binary-path"), capture(captureArguments))) .andReturn(process); replayAll(); launcher.launch(binaryPath, chromeArguments); assertEquals(123, launcher.exitValue()); verifyAll(); }