SequenceConfiguration extends AbstractConfiguration { public JSONObject getSequencesLiveInformation() { LOG.debug("Call sequences status API."); return getterRequest(STATUS_GETTER_URL_POSTFIX); } SequenceConfiguration(WilmaServiceConfig config);  SequenceConfiguration(WilmaServiceConfig config, WilmaHttpClient client); JSONObject getSequencesLiveInformation();  }
@Test public void shouldReturnNullJSONObjectIfClientReturnsOptionalAbsent() { when(client.sendGetterRequest(SEQUENCES_STATUS_URL)).thenReturn(Optional.<String>absent()); JSONObject result = sequenceConfiguration.getSequencesLiveInformation(); assertNull(result); verify(client, never()).sendSetterRequest(anyString()); }
@Test public void shouldReturnJSONObjectWithProperValue() { when(client.sendGetterRequest(SEQUENCES_STATUS_URL)).thenReturn(Optional.of(JSON_STRING)); JSONObject result = sequenceConfiguration.getSequencesLiveInformation(); assertTrue(new JSONObject(JSON_STRING).similar(result), "The two JSON objects should be similar."); verify(client, never()).sendSetterRequest(anyString()); }