BAEL-11: Minor refactorings

This commit is contained in:
slavisa-baeldung 2016-09-15 12:23:14 +02:00
parent 499d51e610
commit ef3b18a717
1 changed files with 3 additions and 5 deletions

View File

@ -21,16 +21,16 @@ import static org.junit.Assert.assertTrue;
@Slf4j
@RunWith(JUnit4.class)
public class BookClientTest {
private BookControllerFeignClientBuilder feignClientBuilder;
private BookClient bookClient;
@Before
public void setup() {
feignClientBuilder = new BookControllerFeignClientBuilder();
BookControllerFeignClientBuilder feignClientBuilder = new BookControllerFeignClientBuilder();
bookClient = feignClientBuilder.getBookClient();
}
@Test
public void givenBookClient_shouldRunSuccessfully() throws Exception {
BookClient bookClient = feignClientBuilder.getBookClient();
List<Book> books = bookClient.findAll().stream()
.map(BookResource::getBook)
.collect(Collectors.toList());
@ -40,7 +40,6 @@ public class BookClientTest {
@Test
public void givenBookClient_shouldFindOneBook() throws Exception {
BookClient bookClient = feignClientBuilder.getBookClient();
Book book = bookClient.findByIsbn("0151072558").getBook();
assertThat(book.getAuthor(), containsString("Orwell"));
log.info("{}", book);
@ -48,7 +47,6 @@ public class BookClientTest {
@Test
public void givenBookClient_shouldPostBook() throws Exception {
BookClient bookClient = feignClientBuilder.getBookClient();
String isbn = UUID.randomUUID().toString();
Book book = new Book(isbn, "Me", "It's me!", null, null);
bookClient.create(book);