Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alert tests fix #1501

Merged
merged 12 commits into from
Jan 20, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.*;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.test.util.ReflectionTestUtils;

import javax.persistence.criteria.CriteriaBuilder;
import java.util.*;
Expand All @@ -42,11 +42,17 @@ class AlertDefineServiceTest {
@Mock
private AlertDefineBindDao alertDefineBindDao;

@Mock
private List<AlertDefineImExportService> alertDefineImExportServiceList;

@InjectMocks
private AlertDefineServiceImpl alertDefineService = new AlertDefineServiceImpl(Collections.emptyList());

@BeforeEach
void setUp() {
ReflectionTestUtils.setField(this.alertDefineService, "alertDefineDao", alertDefineDao);
ReflectionTestUtils.setField(this.alertDefineService, "alertDefineBindDao", alertDefineBindDao);

this.alertDefine = AlertDefine.builder()
.id(1L)
.app("app")
Expand Down Expand Up @@ -162,7 +168,7 @@ void getAlertDefines() {

@Test
void getBindAlertDefineMonitors() {
Long id = 1L;
long id = 1L;
when(alertDefineBindDao.getAlertDefineBindsByAlertDefineIdEquals(id)).thenReturn(alertDefineMonitorBinds);
assertDoesNotThrow(() -> alertDefineService.getBindAlertDefineMonitors(id));
}
Expand Down
Loading