Skip to content

Commit

Permalink
аadded constants
Browse files Browse the repository at this point in the history
  • Loading branch information
fedorovychh committed Jan 9, 2024
1 parent c3886d2 commit d9781d2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class BookControllerTest {
private static final String URL_BOOKS = "/books";
private static final int DEFAULT_AMOUNT_IN_BOOKS_TABLE = 7;
private static MockMvc mockMvc;
private static BookDto bookDto;
@Autowired
Expand Down Expand Up @@ -51,11 +53,11 @@ static void beforeAll(
@Test
@DisplayName("Get all books")
void getAll_ValidRequest_Success() throws Exception {
MvcResult mvcResult = mockMvc.perform(get("/books")).andReturn();
MvcResult mvcResult = mockMvc.perform(get(URL_BOOKS)).andReturn();
List<BookDto> actual = objectMapper
.readValue(mvcResult.getResponse().getContentAsString(),
new TypeReference<>() {
});
Assertions.assertEquals(7, actual.size());
Assertions.assertEquals(DEFAULT_AMOUNT_IN_BOOKS_TABLE, actual.size());
}
}

0 comments on commit d9781d2

Please sign in to comment.