title: Throwing an exception from Mockito
body: <p>I want to throw a <code>ContentIOException</code> from a method whose signature look like this.</p>
  
  <pre><code>public void putContent(InputStream is) throws ContentIOException.
  </code></pre>
  
  <p>When I try to throw <code>ContentIOException</code> from Mockito like such:</p>
  
  <pre><code>when(StubbedObject.putContent(contentStream)).thenThrow(ContentIOException.class);
  </code></pre>
  
  <p>I get the following compilation error:</p>
  
  <pre><code>The method when(T) in the type Mockito is not applicable for the arguments (void).
  </code></pre>
  
  <p>What am I doing wrong?</p>