|
|
@@ -40,11 +40,11 @@ class AlarmMobileServiceTest {
|
|
|
}
|
|
|
|
|
|
@ParameterizedTest @ValueSource(ints = {1, 2, 3})
|
|
|
- void scopeIncludesOnlyDirectCompanyChildren(int root) {
|
|
|
+ void scopeIncludesCompanyChildrenAndSharedManholeChildren(int root) {
|
|
|
when(company.currentCompanyEquipmentRootTypeIds()).thenReturn(Collections.singleton(root));
|
|
|
when(types.selectList(null)).thenReturn(Arrays.asList(type(1,0), type(2,0), type(3,0), type(4,0),
|
|
|
type(11,1), type(21,2), type(31,3), type(41,4), type(111,11)));
|
|
|
- assertEquals(Collections.singletonList(root * 10 + 1), scope.resolveMobile(new MobileAlarmQuery()));
|
|
|
+ assertEquals(new HashSet<>(Arrays.asList(root * 10 + 1, 41)), new HashSet<>(scope.resolveMobile(new MobileAlarmQuery())));
|
|
|
}
|
|
|
@Test void forgedRootBlocksEveryEntryBeforeReadingOrWriting() {
|
|
|
when(company.currentCompanyEquipmentRootTypeIds()).thenReturn(Collections.singleton(1));
|
|
|
@@ -63,7 +63,7 @@ class AlarmMobileServiceTest {
|
|
|
operations.mobilePage(new MobileAlarmQuery());
|
|
|
verify(queries).selectMobilePage(any(), any(), eq(Collections.emptyList()));
|
|
|
}
|
|
|
- @Test void pageFixesUnhandledScopeAndForwardsFiltersAndPagination() {
|
|
|
+ @Test void pageShowsAllAlarmStatusesAndForwardsFiltersAndPagination() {
|
|
|
when(company.currentCompanyEquipmentRootTypeIds()).thenReturn(Collections.singleton(2));
|
|
|
when(types.selectList(null)).thenReturn(Collections.singletonList(type(21,2)));
|
|
|
when(queries.selectMobilePage(any(), any(), anyList())).thenReturn(new Page<>());
|
|
|
@@ -74,7 +74,7 @@ class AlarmMobileServiceTest {
|
|
|
verify(queries).selectMobilePage(argThat(page -> page.getCurrent() == 3 && page.getSize() == 20),
|
|
|
capture.capture(), eq(Collections.singletonList(21)));
|
|
|
AlarmQuery actual = capture.getValue();
|
|
|
- assertEquals(0, actual.getAlarmStatus()); assertEquals(2, actual.getAuditStatus());
|
|
|
+ assertNull(actual.getAlarmStatus()); assertEquals(2, actual.getAuditStatus());
|
|
|
assertEquals("BJ123", actual.getKeyword());
|
|
|
assertEquals(3, actual.getPageNum()); assertEquals(20, actual.getPageSize());
|
|
|
}
|
|
|
@@ -94,7 +94,7 @@ class AlarmMobileServiceTest {
|
|
|
verify(queries).selectMobilePage(argThat(page -> page.getCurrent() == 1 && page.getSize() == 1),
|
|
|
capture.capture(), eq(Collections.singletonList(11)));
|
|
|
AlarmQuery actual = capture.getValue();
|
|
|
- assertEquals(0, actual.getAlarmStatus());
|
|
|
+ assertNull(actual.getAlarmStatus());
|
|
|
assertTrue(actual.getStartTime().toLocalDate().equals(before) || actual.getStartTime().toLocalDate().equals(after));
|
|
|
assertEquals(actual.getStartTime().plusDays(1), actual.getEndTime());
|
|
|
}
|