-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBookServiceTest.java
62 lines (47 loc) · 1.65 KB
/
BookServiceTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.spring.book;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import static org.assertj.core.api.Assertions.*;
@SpringBootTest
class BookServiceTest {
@Autowired
private BookService bookService;
private static final Logger logger = LoggerFactory.getLogger(BookServiceTest.class);
@Test
void shouldFindMostPopularProgrammingBooks() {
var response = this.bookService.findMostPopularProgrammingBooks();
logger.info(response);
assertThat(response).isNotEmpty();
}
@Test
void shouldAnswerWithSystemPromptAndParam() {
var response = this.bookService.answerWithSystemPromptAndParam();
logger.info(response);
assertThat(response).isNotEmpty();
}
@Test
void shouldAnswerWithChatMemory() {
var responseList = this.bookService.answerWithChatMemory();
for (String response : responseList) {
logger.info("here is a response: {}", response);
}
assertThat(responseList).isNotEmpty();
}
@Test
void shouldFindBookEntity() {
var response = this.bookService.findBookEntity();
logger.info("here is a response: {}", response);
assertThat(response.author()).isNotNull();
}
@Test
void shouldFindManyBookEntities() {
var bookList = this.bookService.findBookEntities();
for (Book book : bookList) {
logger.info("here is a response: {}", book.name());
}
assertThat(bookList).isNotEmpty();
}
}