Unit tests for connectException and IOException
<p>I have unit test that tests to see if a method is throwing an error or not.</p>

<pre><code>@Test
public void getStockPriceWithNetworkErrorThrowsException()
{
    StockPriceFetcher stockPriceFetcherWithNetworkError = Mockito.mock(StockPriceFetcher.class);
    when(stockPriceFetcherWithNetworkError.getPrice("YHOO"))
            .thenThrow(new ConnectException("Network error"));

    assetValue = new AssetValue(stockPriceFetcherWithNetworkError);

    try
    {
        assetValue.getStockPrice("YHOO");
        fail("Expected exception for network error.");
    }
    catch(ConnectException e){
        assertEquals(e.getMessage(), "Network error");
    }
}
</code></pre>

<p><code>getPrice</code> is a method from the interface <code>stockPriceFetcher</code>, and <code>getStockPrice</code> simply returns what <code>getPrice()</code> returns. I want a <code>ConnectException</code> to be thrown, but I have an error in the catch block because <code>ConnectException</code> is never thrown in the try block. </p>

<p>Is there anyway I can make this try block throw a <code>ConnectException</code>?</p>