@Test
    public void readResourceNonJsonErrorBody() throws IOException {
        generateStub(500, "Non Json error body");

        try {
            ec2ResourceFetcher.readResource(endpoint);
            fail("Expected AmazonServiceException");
        } catch (AmazonServiceException ase) {
            assertEquals(500, ase.getStatusCode());
            assertNotNull(ase.getErrorMessage());
        }
    }
When server returns a status code other than 200 and 404
and error body message is not in Json format,
the test throws AmazonServiceException.
aws-java-sdk-core/src/test/java/com/amazonaws/internal/EC2ResourceFetcherTest.java