@Test public void shouldReturnNullIfClientReturnsOptionalAbsent() { when(client.sendGetterRequest(LOCALHOST_BLOCKING_STATUS_URL)).thenReturn(Optional.<String>absent()); LocalhostControlStatus result = localhostBlockingConfiguration.getLocalhostBlockingStatus(); assertNull(result); verify(client, never()).sendSetterRequest(anyString()); }
public LocalhostControlStatus getLocalhostBlockingStatus() { LOG.debug("Call localhost blocking status API."); LocalhostControlStatus status = null; JSONObject o = getterRequest(STATUS_GETTER_URL_POSTFIX); if (o != null) { Boolean localhostMode = (Boolean) o.get("localhostMode"); if (localhostMode) { status = LocalhostControlStatus.ON; } else { status = LocalhostControlStatus.OFF; } } return status; }
LocalhostBlockingConfiguration extends AbstractConfiguration { public LocalhostControlStatus getLocalhostBlockingStatus() { LOG.debug("Call localhost blocking status API."); LocalhostControlStatus status = null; JSONObject o = getterRequest(STATUS_GETTER_URL_POSTFIX); if (o != null) { Boolean localhostMode = (Boolean) o.get("localhostMode"); if (localhostMode) { status = LocalhostControlStatus.ON; } else { status = LocalhostControlStatus.OFF; } } return status; } }
LocalhostBlockingConfiguration extends AbstractConfiguration { public LocalhostControlStatus getLocalhostBlockingStatus() { LOG.debug("Call localhost blocking status API."); LocalhostControlStatus status = null; JSONObject o = getterRequest(STATUS_GETTER_URL_POSTFIX); if (o != null) { Boolean localhostMode = (Boolean) o.get("localhostMode"); if (localhostMode) { status = LocalhostControlStatus.ON; } else { status = LocalhostControlStatus.OFF; } } return status; } LocalhostBlockingConfiguration(WilmaServiceConfig config);  LocalhostBlockingConfiguration(WilmaServiceConfig config, WilmaHttpClient client); }
LocalhostBlockingConfiguration extends AbstractConfiguration { public LocalhostControlStatus getLocalhostBlockingStatus() { LOG.debug("Call localhost blocking status API."); LocalhostControlStatus status = null; JSONObject o = getterRequest(STATUS_GETTER_URL_POSTFIX); if (o != null) { Boolean localhostMode = (Boolean) o.get("localhostMode"); if (localhostMode) { status = LocalhostControlStatus.ON; } else { status = LocalhostControlStatus.OFF; } } return status; } LocalhostBlockingConfiguration(WilmaServiceConfig config);  LocalhostBlockingConfiguration(WilmaServiceConfig config, WilmaHttpClient client); LocalhostControlStatus getLocalhostBlockingStatus(); boolean setLocalhostBlockingStatus(LocalhostControlStatus control); }
LocalhostBlockingConfiguration extends AbstractConfiguration { public LocalhostControlStatus getLocalhostBlockingStatus() { LOG.debug("Call localhost blocking status API."); LocalhostControlStatus status = null; JSONObject o = getterRequest(STATUS_GETTER_URL_POSTFIX); if (o != null) { Boolean localhostMode = (Boolean) o.get("localhostMode"); if (localhostMode) { status = LocalhostControlStatus.ON; } else { status = LocalhostControlStatus.OFF; } } return status; } LocalhostBlockingConfiguration(WilmaServiceConfig config);  LocalhostBlockingConfiguration(WilmaServiceConfig config, WilmaHttpClient client); LocalhostControlStatus getLocalhostBlockingStatus(); boolean setLocalhostBlockingStatus(LocalhostControlStatus control);  }