REM:
1. 添加manager层设备管理获取设备信息的单元测试
This commit is contained in:
chenlinghy 2020-08-28 16:53:57 +08:00
parent 393973d033
commit ed34441ea6
1 changed files with 39 additions and 0 deletions

View File

@ -206,4 +206,43 @@ public class DisposeDeviceManagerTest {
}
});
}
/**
* A 4 gets pages of devices.
*/
@Test
public void a4_getPagesOfDevices() {
Integer startPage = 1;
Integer pageSize = 5;
MulReturnType<PageInfo<DisposeDevice>, List<DisposeDevice>> ret = disposeDeviceManager.getPagesOfDevices(startPage, pageSize);
PageInfo<DisposeDevice> pageInfo = ret.getFirstParam();
Assert.assertEquals(pageInfo.getPageNum(), (long) startPage);
Assert.assertEquals(pageInfo.getPageSize(), (long) pageSize);
List<DisposeDevice> deviceList = ret.getSecondParam();
if (pageInfo.getList().size() > 0) {
Assert.assertNotNull(deviceList);
}
}
/**
* A 5 all dispose devices.
*/
@Test
public void a5_getAllNormalDisposeDevices() throws JsonProcessingException {
long normalNumber = disposeDeviceMapper.selectAll().stream().filter(v -> v.getStatus() == ObjectStatus.NORMAL).count();
log.info("normalNumber-->{}", normalNumber);
if (normalNumber > 0) {
List<DisposeDevice> disposeDeviceList = disposeDeviceManager.getAllNormalDisposeDevices();
log.debug(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(disposeDeviceList));
Assert.assertNotNull(disposeDeviceList);
}
}
}