From 5066478069d104bb564ecfc5199321ca447ed3e0 Mon Sep 17 00:00:00 2001 From: chenlinghy Date: Tue, 4 Aug 2020 16:05:04 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E4=BF=AE=E6=94=B9=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E8=83=BD=E5=8A=9B=E7=AE=A1=E7=90=86=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD=E7=9A=84=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mappers/DisposeCapacity.xml | 1 + .../mapper/DisposeCapacityMapperTest.java | 24 ++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/main/resources/mappers/DisposeCapacity.xml b/src/main/resources/mappers/DisposeCapacity.xml index 864a7042..7890a81e 100644 --- a/src/main/resources/mappers/DisposeCapacity.xml +++ b/src/main/resources/mappers/DisposeCapacity.xml @@ -3,6 +3,7 @@ + diff --git a/src/test/java/com/dispose/test/mapper/DisposeCapacityMapperTest.java b/src/test/java/com/dispose/test/mapper/DisposeCapacityMapperTest.java index 3d82cee4..08424c54 100644 --- a/src/test/java/com/dispose/test/mapper/DisposeCapacityMapperTest.java +++ b/src/test/java/com/dispose/test/mapper/DisposeCapacityMapperTest.java @@ -116,15 +116,18 @@ public class DisposeCapacityMapperTest { items = disposeCapacityMapper.delDisposeCapacity(capList.get(0).getDeviceId(), capList.get(0).getCapacityType().getCode()); - Assert.assertEquals(items, 1); + Assert.assertEquals(items, 2); - capList = disposeCapacityMapper.selectAll(); + List caps = disposeCapacityMapper.selectAll(); - Assert.assertEquals(capList.size(), 1); + Assert.assertEquals(caps.size(), capList.size() - items); - log.debug(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList)); + log.debug(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(caps)); } + /** + * A 3 del dispose capacity. + */ @Test public void a3_delDeviceDisposeCapacity() { List newCapList = new ArrayList<>(); @@ -147,12 +150,19 @@ public class DisposeCapacityMapperTest { Assert.assertEquals(disposeCapacityMapper.addNewDisposeCapacity(newCapList), newCapList.size()); + List capList = disposeCapacityMapper.getDeviceDisposeCapacity(1L); + Assert.assertEquals(disposeCapacityMapper.delDeviceDisposeCapacity(newCapList.get(0).getDeviceId()), - newCapList.size()); + capList.size()); Assert.assertEquals(0, disposeCapacityMapper.selectAll().size()); } + /** + * B 1 get dispose capacity. + * + * @throws JsonProcessingException the json processing exception + */ @Test public void b1_getDeviceDisposeCapacity() throws JsonProcessingException { List newCapList = new ArrayList<>(); @@ -173,11 +183,13 @@ public class DisposeCapacityMapperTest { .protectIp("") .build()); + List caps = disposeCapacityMapper.getDeviceDisposeCapacity(1L); + Assert.assertEquals(disposeCapacityMapper.addNewDisposeCapacity(newCapList), newCapList.size()); List capList = disposeCapacityMapper.getDeviceDisposeCapacity(newCapList.get(0).getDeviceId()); - Assert.assertEquals(capList.size(), newCapList.size()); + Assert.assertEquals(capList.size(), caps.size() + newCapList.size()); log.debug(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList)); }