@Test public void shouldReturnNullIfClientReturnsOptionalAbsentForVersionInformation() { when(client.sendGetterRequest(VERSION_INFO_URL)).thenReturn(Optional.<String>absent()); String result = wilmaApplication.getVersionInformation(); assertNull("WilmaVersionInformation is expected to be null.", result); verify(client, never()).sendSetterRequest(anyString()); }
public String getVersionInformation() { LOG.debug("Call version information API."); String url = buildUrl(VERSION_INFO_URL_POSTFIX); String version = null; LOG.debug("Send getter request to: " + url); Optional<String> response = wilmaClient.sendGetterRequest(url); if (response.isPresent()) { JSONObject o = new JSONObject(response.get()); version = o.getString("wilmaVersion"); } return version; }
WilmaApplication { public String getVersionInformation() { LOG.debug("Call version information API."); String url = buildUrl(VERSION_INFO_URL_POSTFIX); String version = null; LOG.debug("Send getter request to: " + url); Optional<String> response = wilmaClient.sendGetterRequest(url); if (response.isPresent()) { JSONObject o = new JSONObject(response.get()); version = o.getString("wilmaVersion"); } return version; } }
WilmaApplication { public String getVersionInformation() { LOG.debug("Call version information API."); String url = buildUrl(VERSION_INFO_URL_POSTFIX); String version = null; LOG.debug("Send getter request to: " + url); Optional<String> response = wilmaClient.sendGetterRequest(url); if (response.isPresent()) { JSONObject o = new JSONObject(response.get()); version = o.getString("wilmaVersion"); } return version; } WilmaApplication(WilmaServiceConfig config);  WilmaApplication(WilmaServiceConfig config, WilmaHttpClient client); }
WilmaApplication { public String getVersionInformation() { LOG.debug("Call version information API."); String url = buildUrl(VERSION_INFO_URL_POSTFIX); String version = null; LOG.debug("Send getter request to: " + url); Optional<String> response = wilmaClient.sendGetterRequest(url); if (response.isPresent()) { JSONObject o = new JSONObject(response.get()); version = o.getString("wilmaVersion"); } return version; } WilmaApplication(WilmaServiceConfig config);  WilmaApplication(WilmaServiceConfig config, WilmaHttpClient client); String getVersionInformation(); WilmaLoadInformation getActualLoadInformation(); boolean shutdownApplication(); JSONObject callGetService(final String serviceQueryString); }
WilmaApplication { public String getVersionInformation() { LOG.debug("Call version information API."); String url = buildUrl(VERSION_INFO_URL_POSTFIX); String version = null; LOG.debug("Send getter request to: " + url); Optional<String> response = wilmaClient.sendGetterRequest(url); if (response.isPresent()) { JSONObject o = new JSONObject(response.get()); version = o.getString("wilmaVersion"); } return version; } WilmaApplication(WilmaServiceConfig config);  WilmaApplication(WilmaServiceConfig config, WilmaHttpClient client); String getVersionInformation(); WilmaLoadInformation getActualLoadInformation(); boolean shutdownApplication(); JSONObject callGetService(final String serviceQueryString);  }