nickwallen commented on a change in pull request #1457: METRON-2176 Upgrade
REST for HBase 2.0.2
URL: https://github.com/apache/metron/pull/1457#discussion_r300126779
##
File path:
metron-interface/metron-rest/src/test/java/org/apache/metron/rest/service/impl/AlertsUIServiceImplTest.java
##
@@ -126,63 +127,63 @@ public void escalateAlertShouldSendMessageToKafka()
throws Exception {
}
@Test
- public void getShouldProperlyReturnActiveProfile() throws Exception {
-when(userSettingsClient.findOne(user1,
AlertsUIServiceImpl.ALERT_USER_SETTING_TYPE)).thenReturn(Optional.of(user1AlertUserSettings));
-
-AlertsUIUserSettings expectedAlertsUIUserSettings = new
AlertsUIUserSettings();
-
expectedAlertsUIUserSettings.setTableColumns(Collections.singletonList("user1_field"));
-assertEquals(expectedAlertsUIUserSettings,
alertsUIService.getAlertsUIUserSettings().get());
-verify(userSettingsClient, times(1)).findOne(user1,
AlertsUIServiceImpl.ALERT_USER_SETTING_TYPE);
-verifyNoMoreInteractions(userSettingsClient);
+ public void shouldGetActiveProfile() throws Exception {
+AlertsUIUserSettings expected = new AlertsUIUserSettings();
+expected.setTableColumns(Collections.singletonList("user1_field"));
+
+// save a profile for current user
+userSettingsClient.save(user1, ALERT_USER_SETTING_TYPE, toJSON(expected));
Review comment:
Being able to use a real `HBaseSettingsClient` instead of a mock made these
tests much easier to grok and maintain in my opinion. Previously we had to use
a lot of mockito-magic to test this.
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org
With regards,
Apache Git Services