@Test
public void shouldThrowExceptionOnSubscriptionToUnknownEvent() throws IOException {

    server.expectRequestTo("http://example.com/subscriptions", "POST")
            .andRespondWith(422, ContentType.APPLICATION_JSON, "{\n" +
                    "  \"type\": \"http://httpstatus.es/422\",\n" +
                    "  \"title\": \"Unprocessable Entity\",\n" +
                    "  \"status\": 422,\n" +
                    "  \"detail\": \"Eventtype does not exist.\"\n" +
                    "}").setup();
    expectedException.expect(IOProblem.class);
    expectedException.expectMessage("Problem [http://httpstatus.es/422] with status [422]: [Unprocessable Entity] [Eventtype does not exist.]");
    client.subscribe("nakadi-client-test", Collections.singleton("non-existing-event"), "nakadi-client-test-consumer", SubscriptionRequest.Position.BEGIN, null, null);
    server.verify();
}