NakadiClient { public void deleteSubscription(String subscriptionId) throws IOException { checkArgument(!subscriptionId.isEmpty(), "Subscription ID cannot be empty."); final URI uri = baseUri.resolve(String.format("/subscriptions/%s", subscriptionId)); final Request request = clientHttpRequestFactory.createRequest(uri, "DELETE"); request.getHeaders().setContentType(ContentType.APPLICATION_JSON); try (final Response response = request.execute()) { final int status = response.getStatusCode(); if (status == 204) { LOG.debug("Successfully deleted subscription [{}]", subscriptionId); } } } NakadiClient(URI baseUri, RequestFactory clientHttpRequestFactory, ObjectMapper objectMapper, CursorManager cursorManager); static NakadiClientBuilder builder(URI baseUri); List<Partition> getPartitions(String eventName); void publish(String eventName, List<T> events); @Deprecated Subscription subscribe(String applicationName, String eventName, String consumerGroup); SubscriptionBuilder subscription(String applicationName, String eventName); SubscriptionBuilder subscription(String applicationName, Set<String> eventNames); void deleteSubscription(String subscriptionId); StreamBuilder.SubscriptionStreamBuilder stream(Subscription subscription); StreamBuilder.LowLevelStreamBuilder stream(String eventName);  }
@Test public void shouldDeleteSubscription() throws IOException { server.expectRequestTo("http: .andRespondWith(204).setup(); client.deleteSubscription("123"); server.verify(); }
@Test public void shouldThrowExceptionOnSubscriptionDeleteFailure() throws IOException { server.expectRequestTo("http: .andRespondWith(404, ContentType.APPLICATION_JSON, "{\n" + " \"type\": \"http: " \"title\": \"Not Found\",\n" + " \"status\": 404,\n" + " \"detail\": \"Subscription not found.\"\n" + "}").setup(); expectedException.expect(IOProblem.class); expectedException.expectMessage("Problem [http: client.deleteSubscription("123"); server.verify(); }