1. 修改部分逻辑

This commit is contained in:
EnderByEndera
2024-01-22 23:40:48 +08:00
parent 095eb88eb3
commit 7432dbd5be
6 changed files with 31 additions and 11 deletions

View File

@@ -13,6 +13,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Random;
import static org.junit.jupiter.api.Assertions.*;
@@ -54,8 +55,7 @@ class CommandServiceTest extends ProtectionApplicationTests {
@Test
void createCommand() {
assertDoesNotThrow(() -> commandService.createCommand(taskCommandInfo));
assertNotNull(taskCommandInfo.getUUID());
assertDoesNotThrow(() -> assertNotNull(commandService.createCommand(taskCommandInfo)));
}
@Test
@@ -85,7 +85,7 @@ class CommandServiceTest extends ProtectionApplicationTests {
}
@Test
void queryCommandByUUID() {
void queryCommandInfos() {
List<TaskCommandInfo> taskCommandInfos = commandService.queryCommandInfos(30L,
null, null, null, null,1, 5);
assertTrue(taskCommandInfos != null && !taskCommandInfos.isEmpty());
@@ -94,4 +94,14 @@ class CommandServiceTest extends ProtectionApplicationTests {
assertNotNull(commandService.queryCommandInfoByUUID(taskCommandInfo.getUUID()));
}
}
@Test
void queryCommandByUUID() {
taskCommandInfo.setTaskId(new Random().nextLong());
String uuid = commandService.createCommand(taskCommandInfo);
TaskCommandInfo taskCommandInfo = commandService.queryCommandInfoByUUID(uuid);
assertNotNull(taskCommandInfo);
assertNotNull(taskCommandInfo.getUUID());
assertEquals(uuid, taskCommandInfo.getUUID());
}
}