Skip to content

Commit

Permalink
Spring Boot update
Browse files Browse the repository at this point in the history
  • Loading branch information
BjoernKW committed Nov 26, 2023
1 parent 3fa11a5 commit 054a53f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.springframework.stereotype.Repository;

@Repository
public interface BookRepository extends ListCrudRepository<Book, Long> {
interface BookRepository extends ListCrudRepository<Book, Long> {

Book findByIsbn(String isbn);
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package de.workshops.bookshelf.book;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;

import java.util.List;
import java.util.stream.StreamSupport;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
class BookRepositoryTest {
Expand All @@ -23,9 +21,10 @@ void createBook() {
String isbn = "123-4567890";
Book book = buildAndSaveBook(isbn);

List<Book> books = StreamSupport
.stream(bookRepository.findAll().spliterator(), false)
.toList();
List<Book> books = bookRepository
.findAll()
.stream()
.toList();

assertNotNull(books);
assertEquals(4, books.size());
Expand Down

0 comments on commit 054a53f

Please sign in to comment.