lab2 fixed updateBookTest
This commit is contained in:
parent
f01db20edf
commit
f25171e835
@ -51,11 +51,19 @@ class BooksTests {
|
|||||||
final BookEntity entity = bookService.get(3L);
|
final BookEntity entity = bookService.get(3L);
|
||||||
final String oldName = entity.getName();
|
final String oldName = entity.getName();
|
||||||
final String test = oldName + "TEST";
|
final String test = oldName + "TEST";
|
||||||
final BookEntity newEntity = bookService.update(3L, new BookEntity(1L, test, entity.getType(), entity.getAuthor()));
|
final var oldType = entity.getType();
|
||||||
|
var testType = typeService.create(new TypeEntity(null, oldType.getName() + "test"));
|
||||||
|
final var oldAuthor = entity.getAuthor();
|
||||||
|
var testAuthor = authorService.create(new AuthorEntity(null, oldAuthor.getName() + "test"));
|
||||||
|
final BookEntity newEntity = bookService.update(3L, new BookEntity(1L, test, testType, testAuthor));
|
||||||
Assertions.assertEquals(3, bookService.getAll().size());
|
Assertions.assertEquals(3, bookService.getAll().size());
|
||||||
Assertions.assertEquals(newEntity, bookService.get(3L));
|
Assertions.assertEquals(newEntity, bookService.get(3L));
|
||||||
Assertions.assertEquals(test, newEntity.getName());
|
Assertions.assertEquals(test, newEntity.getName());
|
||||||
Assertions.assertNotEquals(oldName, newEntity.getName());
|
Assertions.assertNotEquals(oldName, newEntity.getName());
|
||||||
|
Assertions.assertEquals(testType, newEntity.getType());
|
||||||
|
Assertions.assertNotEquals(oldType, newEntity.getType());
|
||||||
|
Assertions.assertEquals(testAuthor, newEntity.getAuthor());
|
||||||
|
Assertions.assertNotEquals(oldAuthor, newEntity.getAuthor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user