AlertsUIServiceImpl implements AlertsUIService { @Override public void saveAlertsUIUserSettings(AlertsUIUserSettings alertsUIUserSettings) throws RestException{ String user = SecurityUtils.getCurrentUser(); try { userSettingsClient.save(user, ALERT_USER_SETTING_TYPE, _mapper.get().writeValueAsString(alertsUIUserSettings)); } catch (IOException e) { throw new RestException(e); } } @Autowired  AlertsUIServiceImpl(final KafkaService kafkaService,
                             final Environment environment,
                             final UserSettingsClient userSettingsClient); @Override void escalateAlerts(List<Map<String, Object>> alerts); @Override Optional<AlertsUIUserSettings> getAlertsUIUserSettings(); @Override Map<String, AlertsUIUserSettings> findAllAlertsUIUserSettings(); @Override void saveAlertsUIUserSettings(AlertsUIUserSettings alertsUIUserSettings); @Override boolean deleteAlertsUIUserSettings(String user); void setClock(Clock clock); static final String ALERT_USER_SETTING_TYPE; static ThreadLocal<ObjectMapper> _mapper; }
@Test public void saveShouldProperlySaveActiveProfile() throws Exception { AlertsUIUserSettings alertsUIUserSettings = new AlertsUIUserSettings(); alertsUIUserSettings.setTableColumns(Collections.singletonList("user1_field")); alertsUIService.saveAlertsUIUserSettings(alertsUIUserSettings); String expectedAlertUserSettings = _mapper.get().writeValueAsString(alertsUIUserSettings); verify(userSettingsClient, times(1)) .save(user1, AlertsUIServiceImpl.ALERT_USER_SETTING_TYPE, expectedAlertUserSettings); verifyNoMoreInteractions(userSettingsClient); }