Skip to content

Commit

Permalink
fix UT
Browse files Browse the repository at this point in the history
  • Loading branch information
saimu.msm committed Mar 27, 2024
1 parent d945345 commit 670ca89
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io.holoinsight.server.home.biz.service.AlertGroupService;
import io.holoinsight.server.home.biz.service.AlertRuleService;
import io.holoinsight.server.home.biz.service.AlertSubscribeService;
import io.holoinsight.server.home.common.service.RequestContextAdapterImpl;
import io.holoinsight.server.home.common.util.scope.MonitorScope;
import io.holoinsight.server.home.common.util.scope.MonitorUser;
import io.holoinsight.server.home.common.util.scope.RequestContext;
Expand Down Expand Up @@ -44,6 +45,7 @@ public void setUp() throws Exception {
facade.alarmSubscribeService = Mockito.mock(AlertSubscribeService.class);
facade.alarmRuleService = Mockito.mock(AlertRuleService.class);
facade.alarmRuleConverter = new AlarmRuleConverterImpl();
facade.requestContextAdapter = new RequestContextAdapterImpl();
MonitorUser mu = new MonitorUser();
mu.setLoginName("test_loginName");
mu.setUserId("test_userId");
Expand Down Expand Up @@ -78,7 +80,8 @@ public void setUp() throws Exception {

@Test
public void testGetRuleListByGroup() {
List<AlarmRuleDTO> alarmRuleDTOList = facade.getRuleListByGroup(true, tenant, workspace);
List<AlarmRuleDTO> alarmRuleDTOList =
facade.getRuleListByGroup(true, "test_tenant", "workspace");

Mockito.verify(facade.alarmRuleService).list(argument.capture());
QueryWrapper<AlarmRule> queryWrapper = argument.getValue();
Expand All @@ -94,7 +97,7 @@ public void testGetRuleListByGroup() {

@Test
public void testGetRuleListByGroup_false() {
facade.getRuleListByGroup(false, tenant, workspace);
facade.getRuleListByGroup(false, "test_tenant", "workspace");
Mockito.verify(facade.alarmRuleService).list(argument.capture());
QueryWrapper<AlarmRule> queryWrapper = argument.getValue();
Assert.assertEquals("(id IN (#{ew.paramNameValuePairs.MPGENVAL1}))",
Expand All @@ -103,7 +106,8 @@ public void testGetRuleListByGroup_false() {

@Test
public void testGetRuleListBySubscribe() {
List<AlarmRuleDTO> alarmRuleDTOList = facade.getRuleListBySubscribe(true, tenant, workspace);
List<AlarmRuleDTO> alarmRuleDTOList =
facade.getRuleListBySubscribe(true, "test_tenant", "workspace");
Mockito.verify(facade.alarmRuleService).list(argument.capture());
QueryWrapper<AlarmRule> queryWrapper = argument.getValue();
Assert.assertEquals(
Expand All @@ -118,7 +122,8 @@ public void testGetRuleListBySubscribe() {

@Test
public void testGetRuleListBySubscribe_false() {
List<AlarmRuleDTO> alarmRuleDTOList = facade.getRuleListBySubscribe(false, tenant, workspace);
List<AlarmRuleDTO> alarmRuleDTOList =
facade.getRuleListBySubscribe(false, "test_tenant", "workspace");
Mockito.verify(facade.alarmRuleService).list(argument.capture());
QueryWrapper<AlarmRule> queryWrapper = argument.getValue();
Assert.assertEquals("(id IN (#{ew.paramNameValuePairs.MPGENVAL1}))",
Expand Down

0 comments on commit 670ca89

Please sign in to comment.