делать много

This commit is contained in:
bekodeg 2024-04-16 12:24:10 +04:00
parent 2bfbd97010
commit 3b96048f90
2 changed files with 11 additions and 12 deletions

View File

@ -28,7 +28,7 @@ class NewsServiceTest {
newsService.create(new NewEntity(null, "Название", new Date(), "тэг", "текст новости"));
final NewEntity last = newsService
.create(new NewEntity(null, "9 апреля", new Date(), "весна", "просто наступил апрель"));
Assertions.assertEquals(1, newsService.getAll().size());
Assertions.assertEquals(last, newsService.get(1L));
Assertions.assertEquals(2L, newsService.getAll().size());
Assertions.assertEquals(last, newsService.get(2L));
}
}

View File

@ -28,35 +28,34 @@ class UserServiceTest {
@Test
@Order(1)
void createTest() {
userService.create(new UserEntity(null, "beko", "111", "ddwwdd", "beko@mail.ru", new Date()));
userService.create(new UserEntity(null, "rara", "rara", "dererere", "rara@mail.ru", new Date()));
Assertions.assertEquals(1, userService.getAll().size());
userService.create(new UserEntity(null, "beko", "111", "ddwwdd",
"beko@mail.ru", new Date()));
userService.create(new UserEntity(null, "rara", "rara", "dererere",
"rara@mail.ru", new Date()));
Assertions.assertEquals(2, userService.getAll().size());
}
@Test
@Order(2)
void updateTest() {
final String test = "TEST";
final UserEntity entity = userService.get(3L);
final String oldName = entity.getName();
final UserEntity newEntity = userService.update(1L,
new UserEntity(1L, test, test, test, "test@mail.ru", new Date()));
Assertions.assertEquals(2, userService.getAll().size());
Assertions.assertEquals(2L, userService.getAll().size());
Assertions.assertEquals(newEntity, userService.get(1L));
Assertions.assertEquals(test, newEntity.getName());
Assertions.assertEquals(oldName, newEntity.getName());
}
@Test
@Order(3)
void deleteTest() {
userService.delete(1L);
Assertions.assertEquals(2, userService.getAll().size());
Assertions.assertEquals(1L, userService.getAll().size());
final UserEntity last = userService.get(2L);
Assertions.assertEquals(2L, last.getId());
final UserEntity newEntity = userService.create(new UserEntity(null, "1", "1", "1", "1@mail.ru", new Date()));
Assertions.assertEquals(2, userService.getAll().size());
Assertions.assertEquals(2L, newEntity.getId());
Assertions.assertEquals(2L, userService.getAll().size());
Assertions.assertEquals(3L, newEntity.getId());
}
}