### Question:
SFlowRTConnection { @Nullable public JsonRestClientResponse put(String path, String someJson) { if (!isInitialized()) { throw new IllegalStateException(EX_MSG_NOT_INITIALIZED); } return putWithoutInitCheck(path, someJson); } SFlowRTConnection(ScheduledExecutorService executor, String collectorUri, FlowCache flowCache, JsonRestClient client); @Nullable String getJsonResponse(String path, MultivaluedMap<String, String> params); @Nullable JsonRestClientResponse get(String path,
            MultivaluedMap<String, String> params); @Nullable JsonRestClientResponse put(String path, String someJson); JsonRestClientResponse delete(String path); boolean isInitialized(); FlowCache getFlowCache(); ScheduledExecutorService getExecutor(); String getCollectorUri(); void initialize();  }### Answer:
@Test public void testPut() { JsonRestClientResponse res = connection.put(PATH, JSON_STRING); assertEquals(response, res); }
@Test(expected = ClientHandlerException.class) public void testPut_ClientHandlerException_noCause() { ClientHandlerException ex = new ClientHandlerException(); when(client.put(any(String.class), any(String.class))).thenThrow(ex); connection.put(PATH, JSON_STRING); }
@Test(expected = ClientHandlerException.class) public void testPut_ClientHandlerException_caused() { ClientHandlerException ex = new ClientHandlerException(); ex.initCause(new java.net.ConnectException()); when(client.put(any(String.class), any(String.class))).thenThrow(ex); connection.put(PATH, JSON_STRING); }