From d90f961ea587d8e8f6468418fbb6bfcaf9f19292 Mon Sep 17 00:00:00 2001 From: chenlinghy Date: Tue, 30 Jun 2020 17:23:24 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E8=A7=A3=E5=86=B3=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B=202.=20?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E7=8A=B6=E6=80=81=E7=9A=84=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dispose/mapper/TaskInfoMapper.java | 7 +++++++ src/main/resources/mappers/TaskInfoMapper.xml | 8 +++++++- .../com/dispose/test/mapper/TaskInfoMapperTest.java | 13 ++++--------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/dispose/mapper/TaskInfoMapper.java b/src/main/java/com/dispose/mapper/TaskInfoMapper.java index 02f12c46..9676e034 100644 --- a/src/main/java/com/dispose/mapper/TaskInfoMapper.java +++ b/src/main/java/com/dispose/mapper/TaskInfoMapper.java @@ -53,4 +53,11 @@ public interface TaskInfoMapper extends Mapper, MySqlMapper */ void changeTaskInfoStatus(@Param("id") Long id, @Param("status") Long status); + + /** + * get task info status. + * + * @param id the id + */ + int getTaskInfoCurrentStatus(Long id); } diff --git a/src/main/resources/mappers/TaskInfoMapper.xml b/src/main/resources/mappers/TaskInfoMapper.xml index 12302227..687a9dcc 100644 --- a/src/main/resources/mappers/TaskInfoMapper.xml +++ b/src/main/resources/mappers/TaskInfoMapper.xml @@ -28,4 +28,10 @@ id = #{id, jdbcType=INTEGER} - \ No newline at end of file + + + diff --git a/src/test/java/com/dispose/test/mapper/TaskInfoMapperTest.java b/src/test/java/com/dispose/test/mapper/TaskInfoMapperTest.java index 42390150..899ea430 100644 --- a/src/test/java/com/dispose/test/mapper/TaskInfoMapperTest.java +++ b/src/test/java/com/dispose/test/mapper/TaskInfoMapperTest.java @@ -162,22 +162,17 @@ public class TaskInfoMapperTest extends InitTestEnvironment { ) { Assert.assertNotNull(taskInfo.getStatus()); Long beforeStatus = taskInfo.getStatus(); - long changeStatus; - if(beforeStatus == 0){ + long changeStatus = 0; + if (beforeStatus == 0) { changeStatus = 1L; - }else{ - changeStatus = 0L; } log.info("task_info table Id-->{}, before Status-->{}, change Stauts-->{}", - taskInfo.getId(),taskInfo.getStatus(),changeStatus); + taskInfo.getId(), taskInfo.getStatus(), changeStatus); taskInfoMapper.changeTaskInfoStatus(taskInfo.getId(), changeStatus); - log.info("task_info before Status-->{}, after Stauts-->{}", - beforeStatus, taskInfo.getStatus()); - Assert.assertEquals(beforeStatus, taskInfo.getStatus()); - log.info("change task info Status-->{}", taskInfo.getStatus()); + Assert.assertNotEquals(beforeStatus, new Long((long) taskInfoMapper.getTaskInfoCurrentStatus(taskInfo.getId()))); } } }