From ed34441ea61bdc3c7ac3f9ec51ccf8be5b3de191 Mon Sep 17 00:00:00 2001 From: chenlinghy Date: Fri, 28 Aug 2020 16:53:57 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E6=B7=BB=E5=8A=A0manager?= =?UTF-8?q?=E5=B1=82=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=BF=A1=E6=81=AF=E7=9A=84=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manager/DisposeDeviceManagerTest.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/test/java/com/dispose/test/manager/DisposeDeviceManagerTest.java b/src/test/java/com/dispose/test/manager/DisposeDeviceManagerTest.java index 6c0092ec..dc33b9c1 100644 --- a/src/test/java/com/dispose/test/manager/DisposeDeviceManagerTest.java +++ b/src/test/java/com/dispose/test/manager/DisposeDeviceManagerTest.java @@ -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, List> ret = disposeDeviceManager.getPagesOfDevices(startPage, pageSize); + + PageInfo pageInfo = ret.getFirstParam(); + Assert.assertEquals(pageInfo.getPageNum(), (long) startPage); + Assert.assertEquals(pageInfo.getPageSize(), (long) pageSize); + + List 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 disposeDeviceList = disposeDeviceManager.getAllNormalDisposeDevices(); + + log.debug(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(disposeDeviceList)); + + Assert.assertNotNull(disposeDeviceList); + } + } }