@Test(dataProvider = "testdata") public void shouldReturnFalseForDropAllStubConfigIfTheGivenJSONIsIncorrect(String jsonString) { when(client.sendGetterRequest(STUB_STATUS_URL)).thenReturn(Optional.<String>of(jsonString)); assertFalse(stubConfiguration.dropAllStubConfig()); }
public boolean dropAllStubConfig() { LOG.debug("Call drop all stub configuration."); boolean droppedAllStubConfig = true; JSONObject stubConfig = getStubConfigInformation(); if ((stubConfig != null) && (stubConfig.length() > 0)) { try { LOG.debug("Gets stub configs array from all stub configuration JSON."); JSONArray configs = stubConfig.getJSONArray("configs"); for (int i = 0; i < configs.length(); i++) { LOG.debug("Get the stub group name."); String groupName = configs.getJSONObject(i).getString("groupname"); droppedAllStubConfig &= dropStubConfig(groupName); LOG.info("Dropped stub configuration: {}", groupName); } } catch (JSONException e) { LOG.error("Error occurred while dropping sub configuration. ", e); droppedAllStubConfig = false; } } else { droppedAllStubConfig = false; } return droppedAllStubConfig; }
StubConfiguration extends AbstractConfiguration { public boolean dropAllStubConfig() { LOG.debug("Call drop all stub configuration."); boolean droppedAllStubConfig = true; JSONObject stubConfig = getStubConfigInformation(); if ((stubConfig != null) && (stubConfig.length() > 0)) { try { LOG.debug("Gets stub configs array from all stub configuration JSON."); JSONArray configs = stubConfig.getJSONArray("configs"); for (int i = 0; i < configs.length(); i++) { LOG.debug("Get the stub group name."); String groupName = configs.getJSONObject(i).getString("groupname"); droppedAllStubConfig &= dropStubConfig(groupName); LOG.info("Dropped stub configuration: {}", groupName); } } catch (JSONException e) { LOG.error("Error occurred while dropping sub configuration. ", e); droppedAllStubConfig = false; } } else { droppedAllStubConfig = false; } return droppedAllStubConfig; } }
StubConfiguration extends AbstractConfiguration { public boolean dropAllStubConfig() { LOG.debug("Call drop all stub configuration."); boolean droppedAllStubConfig = true; JSONObject stubConfig = getStubConfigInformation(); if ((stubConfig != null) && (stubConfig.length() > 0)) { try { LOG.debug("Gets stub configs array from all stub configuration JSON."); JSONArray configs = stubConfig.getJSONArray("configs"); for (int i = 0; i < configs.length(); i++) { LOG.debug("Get the stub group name."); String groupName = configs.getJSONObject(i).getString("groupname"); droppedAllStubConfig &= dropStubConfig(groupName); LOG.info("Dropped stub configuration: {}", groupName); } } catch (JSONException e) { LOG.error("Error occurred while dropping sub configuration. ", e); droppedAllStubConfig = false; } } else { droppedAllStubConfig = false; } return droppedAllStubConfig; } StubConfiguration(WilmaServiceConfig config);  StubConfiguration(WilmaServiceConfig config, WilmaHttpClient client); }
StubConfiguration extends AbstractConfiguration { public boolean dropAllStubConfig() { LOG.debug("Call drop all stub configuration."); boolean droppedAllStubConfig = true; JSONObject stubConfig = getStubConfigInformation(); if ((stubConfig != null) && (stubConfig.length() > 0)) { try { LOG.debug("Gets stub configs array from all stub configuration JSON."); JSONArray configs = stubConfig.getJSONArray("configs"); for (int i = 0; i < configs.length(); i++) { LOG.debug("Get the stub group name."); String groupName = configs.getJSONObject(i).getString("groupname"); droppedAllStubConfig &= dropStubConfig(groupName); LOG.info("Dropped stub configuration: {}", groupName); } } catch (JSONException e) { LOG.error("Error occurred while dropping sub configuration. ", e); droppedAllStubConfig = false; } } else { droppedAllStubConfig = false; } return droppedAllStubConfig; } StubConfiguration(WilmaServiceConfig config);  StubConfiguration(WilmaServiceConfig config, WilmaHttpClient client); JSONObject getStubConfigInformation(); boolean setStubConfigStatus(String groupName, StubConfigStatus status); boolean setStubConfigOrder(String groupName, StubConfigOrder order); boolean dropStubConfig(String groupName); boolean dropAllStubConfig(); boolean persistActualStubConfig(); }
StubConfiguration extends AbstractConfiguration { public boolean dropAllStubConfig() { LOG.debug("Call drop all stub configuration."); boolean droppedAllStubConfig = true; JSONObject stubConfig = getStubConfigInformation(); if ((stubConfig != null) && (stubConfig.length() > 0)) { try { LOG.debug("Gets stub configs array from all stub configuration JSON."); JSONArray configs = stubConfig.getJSONArray("configs"); for (int i = 0; i < configs.length(); i++) { LOG.debug("Get the stub group name."); String groupName = configs.getJSONObject(i).getString("groupname"); droppedAllStubConfig &= dropStubConfig(groupName); LOG.info("Dropped stub configuration: {}", groupName); } } catch (JSONException e) { LOG.error("Error occurred while dropping sub configuration. ", e); droppedAllStubConfig = false; } } else { droppedAllStubConfig = false; } return droppedAllStubConfig; } StubConfiguration(WilmaServiceConfig config);  StubConfiguration(WilmaServiceConfig config, WilmaHttpClient client); JSONObject getStubConfigInformation(); boolean setStubConfigStatus(String groupName, StubConfigStatus status); boolean setStubConfigOrder(String groupName, StubConfigOrder order); boolean dropStubConfig(String groupName); boolean dropAllStubConfig(); boolean persistActualStubConfig();  }