minor formatting cleanup

This commit is contained in:
eugenp
2017-08-24 13:11:52 +03:00
parent 74e67d6ce9
commit 1cba1b043c
194 changed files with 1147 additions and 1005 deletions

View File

@@ -14,6 +14,12 @@ public class BookControllerFeignClientBuilder {
private BookClient bookClient = createClient(BookClient.class, "http://localhost:8081/api/books");
private static <T> T createClient(Class<T> type, String uri) {
return Feign.builder().client(new OkHttpClient()).encoder(new GsonEncoder()).decoder(new GsonDecoder()).logger(new Slf4jLogger(type)).logLevel(Logger.Level.FULL).target(type, uri);
return Feign.builder()
.client(new OkHttpClient())
.encoder(new GsonEncoder())
.decoder(new GsonDecoder())
.logger(new Slf4jLogger(type))
.logLevel(Logger.Level.FULL)
.target(type, uri);
}
}

View File

@@ -34,25 +34,31 @@ public class BookClientLiveTest {
@Test
public void givenBookClient_shouldRunSuccessfully() throws Exception {
List<Book> books = bookClient.findAll().stream().map(BookResource::getBook).collect(Collectors.toList());
List<Book> books = bookClient.findAll()
.stream()
.map(BookResource::getBook)
.collect(Collectors.toList());
assertTrue(books.size() > 2);
log.info("{}", books);
}
@Test
public void givenBookClient_shouldFindOneBook() throws Exception {
Book book = bookClient.findByIsbn("0151072558").getBook();
Book book = bookClient.findByIsbn("0151072558")
.getBook();
assertThat(book.getAuthor(), containsString("Orwell"));
log.info("{}", book);
}
@Test
public void givenBookClient_shouldPostBook() throws Exception {
String isbn = UUID.randomUUID().toString();
String isbn = UUID.randomUUID()
.toString();
Book book = new Book(isbn, "Me", "It's me!", null, null);
bookClient.create(book);
book = bookClient.findByIsbn(isbn).getBook();
book = bookClient.findByIsbn(isbn)
.getBook();
assertThat(book.getAuthor(), is("Me"));
log.info("{}", book);
}