diff --git a/src/test/java/com/app/bookstore/controller/BookControllerTest.java b/src/test/java/com/app/bookstore/controller/BookControllerTest.java index 0f68243..0c64648 100644 --- a/src/test/java/com/app/bookstore/controller/BookControllerTest.java +++ b/src/test/java/com/app/bookstore/controller/BookControllerTest.java @@ -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 @@ -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 actual = objectMapper .readValue(mvcResult.getResponse().getContentAsString(), new TypeReference<>() { }); - Assertions.assertEquals(7, actual.size()); + Assertions.assertEquals(DEFAULT_AMOUNT_IN_BOOKS_TABLE, actual.size()); } }