пара дополнений в тесте новостей
This commit is contained in:
parent
c69c842b1f
commit
1fdac282b4
@ -10,10 +10,37 @@ class NewsServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
void createTest() {
|
||||
newsService.create(new NewsEntity(null, "Название", "2024-02-10", "тэг", "текст новости"));
|
||||
final NewsEntity last = newsService.create(new NewsEntity(null, "9 апреля", "2024-04-09", "весна", "просто наступил апрель"));
|
||||
Assertions.assertEquals(1, newsService.getAll().size());
|
||||
Assertions.assertEquals(last, newsService.get(1L));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
void updateTest() {
|
||||
final String test = "TEST";
|
||||
final NewsEntity entity = newsService.get(3L);
|
||||
final String oldName = entity.getName();
|
||||
final NewsEntity newEntity = newsService.update(1, new NewsEntity(1L, test, new Date(), test, test));
|
||||
Assertions.assertEquals(2, newsService.getAll().size());
|
||||
Assertions.assertEquals(newEntity, newsService.get(1L));
|
||||
Assertions.assertEquals(test, newEntity.getName());
|
||||
Assertions.assertEquals(oldName, newEntity.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
void deleteTest() {
|
||||
newsService.delete(1L);
|
||||
Assertions.assertEquals(2, newsService.getAll().size());
|
||||
final NewsEntity last = NewsService.get(2L);
|
||||
Assertions.assertEquals(2L, last.getId());
|
||||
|
||||
final NewsEntity newEntity = newsService.create(new NewsEntity(null, "9 апреля", "2024-04-09", "весна", "просто наступил апрель"));
|
||||
Assertions.assertEquals(2, newsService.getAll().size());
|
||||
Assertions.assertEquals(2L, newEntity.getId());
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ class UserServiceTest {
|
||||
@Order(1)
|
||||
void createTest() {
|
||||
userService.create(new UserEntity(null, "beko", "111", "ddwwdd", "beko@mail.ru", "2004-04-04"));
|
||||
userService.create(new UserEntity(null, "rara", "rara", "dererere", "rara@mail.ru", "2001-01-01"));
|
||||
userService.create(new UserEntity(null, "lambda", "lambda", "Лямбда Дельта", "lambda@mail.ru", "2001-01-01"));
|
||||
Assertions.assertEquals(1, userService.getAll().size());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user