@Test
    public void items_shouldThrowExceptionIfWebServerRespondError() {
        for (Integer errorCode : HttpCodes.clientAndServerSideErrorCodes()) {
            mockWebServer.enqueue(new MockResponse().setStatus("HTTP/1.1 " + errorCode + " Not today"));

            try {
                qualityMattersRestApi.items().toBlocking().value();
                fail("HttpException should be thrown for error code: " + errorCode);
            } catch (RuntimeException expected) {
                HttpException httpException = (HttpException) expected.getCause();
                assertThat(httpException.code()).isEqualTo(errorCode);
                assertThat(httpException.message()).isEqualTo("Not today");
            }
        }
    }
Main purpose of Integration tests is to check that all layers of your app work correctly, for example:
<ul>
<li>Http layer</li>
<li>REST layer</li>
<li>Parsing/Serializing layer</li>
<li>Execution layer (ie RxJava)</li>
</ul>
app/src/integrationTests/java/com/artemzin/qualitymatters/integration_tests/api/QualityMattersRestApiIntegrationTest.java