### Question:
ParametersServiceImpl implements ParametersService { @Override public boolean saveParameters(Map<String, String> parameters) { boolean saveSuccess = true; for(Map.Entry<String, String> entry: parameters.entrySet()) { String uiKey = entry.getKey(); String value = entry.getValue(); String configKey = keyTranslator.getConfigKey(uiKey); String component = configKey.split("[.]")[0]; try { configurationService.setConfigurationValue(component, configKey, value); } catch (Exception e) { saveSuccess = false; e.printStackTrace(); } } return saveSuccess; }  @Override boolean saveParameters(Map<String, String> parameters); @Override Map<String, String> getParameters(); @Autowired void setConfigurationService(ConfigurationService configurationService); @Autowired void setKeyTranslator(ConfigurationKeyTranslator keyTranslator);  }### Answer:
@Test public void testSaveParameters() throws Exception { Map<String, String> parameters = new HashMap<String, String>(); parameters.put("tdmCrewAssignmentRefreshKey", "120"); parameters.put("adminSenderEmailAddressKey", "mtabuscis@mtabuscis.net"); boolean success = service.saveParameters(parameters); assertTrue("Expecting save operation to be successful", success); verify(configurationService).setConfigurationValue("tdm", "tdm.crewAssignmentRefreshInterval", "120"); verify(configurationService).setConfigurationValue("admin", "admin.senderEmailAddress", "mtabuscis@mtabuscis.net"); }
@Test public void testSaveParametersException() throws Exception { Map<String, String> parameters = new HashMap<String, String>(); parameters.put("tdmCrewAssignmentRefreshKey", "120"); parameters.put("adminSenderEmailAddressKey", "mtabuscis@mtabuscis.net"); doThrow(new Exception()).when(configurationService). setConfigurationValue("tdm", "tdm.crewAssignmentRefreshInterval", "120"); boolean success = service.saveParameters(parameters); assertFalse("Expecting save operation to be successful", success); verify(configurationService).setConfigurationValue("admin", "admin.senderEmailAddress", "mtabuscis@mtabuscis.net"); }