Skip to content

Commit

Permalink
修改单测逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
MoYu-zc committed Dec 26, 2024
1 parent a11e4d7 commit 6c589c8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
package com.alibaba.easyretry.extension.mybatis.access;

import java.util.Date;
import java.util.List;
import java.util.Objects;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;

import com.alibaba.easyretry.common.constant.enums.RetryTaskStatusEnum;
import com.alibaba.easyretry.common.entity.RetryTask;
import com.alibaba.easyretry.extension.mybatis.MyBatisConfig;
import com.alibaba.easyretry.extension.mybatis.dao.RetryTaskDAOImpl;
import org.junit.jupiter.api.*;

import java.util.Date;
import java.util.List;
import java.util.Objects;

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class MybatisRetryTaskAccessTest {
Expand Down Expand Up @@ -39,7 +45,7 @@ void saveTask() {
@Test
@Order(2)
void handle() {
ACCESS.saveRetryTask(task);
// ACCESS.saveRetryTask(task);
Assertions.assertTrue(ACCESS.handlingRetryTask(task));
List<RetryTask> retryTasks = ACCESS.listAvailableTasks(1L);
Assertions.assertTrue(Objects.nonNull(retryTasks) && !retryTasks.isEmpty());
Expand All @@ -49,7 +55,7 @@ void handle() {
@Test
@Order(3)
void stop() {
ACCESS.saveRetryTask(task);
// ACCESS.saveRetryTask(task);
boolean b = ACCESS.stopRetryTask(task);
Assertions.assertTrue(b);
List<RetryTask> retryTasks = ACCESS.listAvailableTasks(1L);
Expand All @@ -59,7 +65,7 @@ void stop() {
@Test
@Order(4)
void finish(){
ACCESS.saveRetryTask(task);
// ACCESS.saveRetryTask(task);
Assertions.assertTrue(ACCESS.finishRetryTask(task));
List<RetryTask> retryTasks = ACCESS.listAvailableTasks(1L);
Assertions.assertTrue(Objects.isNull(retryTasks) || retryTasks.isEmpty());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package com.alibaba.easyretry.extension.mybatis.dao;

import com.alibaba.easyretry.common.constant.enums.RetryTaskStatusEnum;
import com.alibaba.easyretry.extension.mybatis.MyBatisConfig;
import com.alibaba.easyretry.extension.mybatis.po.RetryTaskPO;
import com.alibaba.easyretry.extension.mybatis.query.RetryTaskQuery;
import org.junit.jupiter.api.*;

import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Objects;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;

import com.alibaba.easyretry.common.constant.enums.RetryTaskStatusEnum;
import com.alibaba.easyretry.extension.mybatis.MyBatisConfig;
import com.alibaba.easyretry.extension.mybatis.po.RetryTaskPO;
import com.alibaba.easyretry.extension.mybatis.query.RetryTaskQuery;

class RetryTaskDAOImplTest {

private static RetryTaskDAO retryTaskDAO;
Expand Down Expand Up @@ -38,9 +42,9 @@ void saveTask() {
@Order(2)
void listRetryTask() {
final RetryTaskPO retryTaskPO = new RetryTaskPO()
.setId(1L)
.setId(2L)
.setGmtCreate(new Date())
.setBizId("1")
.setBizId("2")
.setRetryStatus(RetryTaskStatusEnum.HANDLING.getCode())
.setGmtModified(new Date());

Expand Down Expand Up @@ -77,9 +81,9 @@ void updateRetryTask() {
@Order(4)
void deleteRetryTask() {
final RetryTaskPO retryTaskPO = new RetryTaskPO()
.setId(1L)
.setId(3L)
.setGmtCreate(new Date())
.setBizId("1")
.setBizId("3")
.setRetryStatus(RetryTaskStatusEnum.HANDLING.getCode())
.setGmtModified(new Date());

Expand Down

0 comments on commit 6c589c8

Please sign in to comment.