NakadiClient { public List<Partition> getPartitions(String eventName) throws IOException { final URI uri = baseUri.resolve(String.format("/event-types/%s/partitions", eventName)); final Request request = clientHttpRequestFactory.createRequest(uri, "GET"); try (final Response response = request.execute()) { try (final InputStream is = response.getBody()) { return internalObjectMapper.readValue(is, LIST_OF_PARTITIONS); } } } 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 shouldGetPartitions() throws IOException { server.expectRequestTo("http: .andRespondWith(200, ContentType.APPLICATION_JSON, "[{\"partition\":\"0\", \"oldest_available_offset\":\"10\", \"newest_available_offset\":\"20\"},{\"partition\":\"1\", \"oldest_available_offset\":\"BEGIN\",\"newest_available_offset\":\"10\"}]") .setup(); final List<Partition> partitions = client.getPartitions("foobar"); assertNotNull(partitions); assertThat(partitions, hasSize(2)); server.verify(); }