List of usage examples for java.lang IllegalThreadStateException IllegalThreadStateException
public IllegalThreadStateException()
IllegalThreadStateException
with no detail message. From source file:com.thoughtworks.go.util.ProcessWrapperTest.java
@Test public void shouldReturnTrueWhenAProcessIsRunning() { Process process = getMockedProcess(mock(OutputStream.class)); when(process.exitValue()).thenThrow(new IllegalThreadStateException()); ProcessWrapper processWrapper = new ProcessWrapper(process, "", "", inMemoryConsumer(), null, null); assertThat(processWrapper.isRunning(), is(true)); }
From source file:org.sonar.home.cache.FileHashesTest.java
@Test public void fail_if_stream_is_closed() throws Exception { thrown.expect(IllegalStateException.class); thrown.expectMessage("Fail to compute hash"); InputStream input = mock(InputStream.class); when(input.read(any(byte[].class), anyInt(), anyInt())).thenThrow(new IllegalThreadStateException()); new FileHashes().of(input); }
From source file:org.sonarsource.sonarlint.core.plugin.cache.PluginHashesTest.java
@Test public void fail_if_stream_is_closed() throws Exception { thrown.expect(IllegalStateException.class); thrown.expectMessage("Fail to compute hash"); InputStream input = mock(InputStream.class); when(input.read(any(byte[].class), anyInt(), anyInt())).thenThrow(new IllegalThreadStateException()); new PluginHashes().of(input); }
From source file:sf.net.experimaestro.connectors.XPMProcess.java
/** * Returns the error code/* w w w. ja va 2 s.com*/ */ public int exitValue() { // Check for done file try { if (job.getLocator().resolve(connector, Resource.DONE_EXTENSION).exists()) return 0; // If the job is not done, check the ".code" file to get the error code // and otherwise return -1 final FileObject codeFile = job.getMainConnector() .resolveFile(job.getLocator().getPath() + Job.CODE_EXTENSION); if (codeFile.exists()) { final InputStream stream = codeFile.getContent().getInputStream(); final BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); String s = reader.readLine(); int code = s != null ? Integer.parseInt(s) : -1; reader.close(); return code; } } catch (IOException e) { throw new IllegalThreadStateException(); } // The process failed, but we do not know how return -1; }