REM:
1. 修改设备能力管理数据库相关功能的单元测试用例
This commit is contained in:
chenlinghy 2020-08-04 16:05:04 +08:00
parent e63873332c
commit 5066478069
2 changed files with 19 additions and 6 deletions

View File

@ -3,6 +3,7 @@
<mapper namespace="com.dispose.mapper.DisposeCapacityMapper">
<resultMap id="dispose_capacity" type="com.dispose.pojo.entity.DisposeCapacity">
<id column="id" property="id"/>
<id column = "deviceId" property="deviceId"/>
<result column="capacityType" property="capacityType" javaType="com.dispose.common.DisposeCapacityType"/>
<result column="objectType" property="objectType" javaType="com.dispose.common.DisposeObjectType"/>
<result column="ipType" property="ipType" javaType="com.dispose.common.IpAddrType"/>

View File

@ -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<DisposeCapacity> 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<DisposeCapacity> newCapList = new ArrayList<>();
@ -147,12 +150,19 @@ public class DisposeCapacityMapperTest {
Assert.assertEquals(disposeCapacityMapper.addNewDisposeCapacity(newCapList), newCapList.size());
List<DisposeCapacity> 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<DisposeCapacity> newCapList = new ArrayList<>();
@ -173,11 +183,13 @@ public class DisposeCapacityMapperTest {
.protectIp("")
.build());
List<DisposeCapacity> caps = disposeCapacityMapper.getDeviceDisposeCapacity(1L);
Assert.assertEquals(disposeCapacityMapper.addNewDisposeCapacity(newCapList), newCapList.size());
List<DisposeCapacity> 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));
}