@Test(expected = SonarResourceNotFoundException.class)
public void should_throw_exception_when_connection_exception() throws Exception {

    when(sonar.find(any(ResourceQuery.class))).thenThrow(new ConnectionException());
    sonarClient.findResource("resourceId");
}