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)); }