ResponseMessageVolatilityConfiguration extends AbstractConfiguration { public ResponseMessageVolatilityStatus getResponseMessageVolatilityStatus() { LOG.debug("Call response message volatility status API."); ResponseMessageVolatilityStatus status = null; JSONObject o = getterRequest(STATUS_GETTER_URL_POSTFIX); if (o != null) { Boolean responseVolatility = (Boolean) o.get("responseVolatility"); if (responseVolatility) { status = ResponseMessageVolatilityStatus.ON; } else { status = ResponseMessageVolatilityStatus.OFF; } } return status; } ResponseMessageVolatilityConfiguration(WilmaServiceConfig config);  ResponseMessageVolatilityConfiguration(WilmaServiceConfig config, WilmaHttpClient client); ResponseMessageVolatilityStatus getResponseMessageVolatilityStatus(); boolean setResponseMessageVolatilityStatus(ResponseMessageVolatilityStatus control);  }
@Test public void shouldReturnNullIfClientReturnsOptionalAbsent() { when(client.sendGetterRequest(MARKING_STATUS_URL)).thenReturn(Optional.<String>absent()); ResponseMessageVolatilityStatus result = responseMessageVolatilityConfiguration.getResponseMessageVolatilityStatus(); assertNull(result); verify(client, never()).sendSetterRequest(anyString()); }
@Test public void shouldReturnJSONObjectWithProperValue() { when(client.sendGetterRequest(MARKING_STATUS_URL)).thenReturn(Optional.of(JSON_STRING)); ResponseMessageVolatilityStatus result = responseMessageVolatilityConfiguration.getResponseMessageVolatilityStatus(); Assert.assertTrue(result == ResponseMessageVolatilityStatus.ON); verify(client, never()).sendSetterRequest(anyString()); }