добавлены новые тесты к каждой сущности

This commit is contained in:
2024-04-30 12:37:08 +04:00
parent 55284eacbc
commit 66bfe560cd
5 changed files with 56 additions and 24 deletions

View File

@@ -10,6 +10,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import com.example.demo.core.error.NotFoundException;
import com.example.demo.tage.model.TageEntity;
import com.example.demo.tage.service.TageService;
import com.example.demo.users.model.UserEntity;
@SpringBootTest
@TestMethodOrder(OrderAnnotation.class)
@@ -23,11 +24,25 @@ public class TageServiceTest {
}
@Test
void createTest() {
void Test() {
//create
tageService.create(new TageEntity(null, "праздник"));
final var last = tageService.create(new TageEntity(null, "конкурс"));
Assertions.assertEquals(2L, tageService.getAll().size());
Assertions.assertEquals(last, tageService.get(2L));
//update
final String test = "TEST";
final var newTage = tageService.update(1L, new TageEntity(1L, test));
Assertions.assertEquals(2L, tageService.getAll().size());
Assertions.assertEquals(newTage, tageService.get(1L));
//delete
tageService.delete(1L);
Assertions.assertEquals(1L, tageService.getAll().size());
final var lastTage = tageService.get(2L);
Assertions.assertEquals(2L, lastTage.getId());
}
}