mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-07 06:14:49 +00:00
#1284 Use local variable inference
This commit is contained in:
1 parent
2332520d67
commit
97e3a3debc
4 files changed
+15
-15
No files matched your search
@@ -33,17 +33,17 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
class BookRepositoryTest {
|
||||
@Test
|
||||
void testBookRepository() throws BookDuplicateException, BookNotFoundException, VersionMismatchException {
|
||||
final long bookId = 1;
|
||||
final var bookId = 1;
|
||||
|
||||
BookRepository bookRepository = new BookRepository();
|
||||
Book book = new Book();
|
||||
var bookRepository = new BookRepository();
|
||||
var book = new Book();
|
||||
book.setId(bookId);
|
||||
bookRepository.add(book);
|
||||
|
||||
assertEquals(0, book.getVersion());
|
||||
|
||||
final Book aliceBook = bookRepository.get(bookId);
|
||||
final Book bobBook = bookRepository.get(bookId);
|
||||
final var aliceBook = bookRepository.get(bookId);
|
||||
final var bobBook = bookRepository.get(bookId);
|
||||
|
||||
assertEquals(aliceBook.getTitle(), bobBook.getTitle());
|
||||
assertEquals(aliceBook.getAuthor(), bobBook.getAuthor());
|
||||
|
||||
Reference in new issue
Block a user