-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add review test, delete useless files
- Loading branch information
Showing
24 changed files
with
60 additions
and
19 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/test/java/ru/nsu/fit/directors/establishmentservice/EstablishmentReviewTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package ru.nsu.fit.directors.establishmentservice; | ||
|
||
import com.github.springtestdbunit.annotation.DatabaseSetup; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; | ||
|
||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
@DisplayName("Проверка работы с отзывами") | ||
@DatabaseSetup("/database/establishment/default_establishment.xml") | ||
class EstablishmentReviewTest extends EstablishmentServiceApplicationTests { | ||
|
||
@Test | ||
@DisplayName("Получение отзывов") | ||
@DatabaseSetup("/database/review/review_list.xml") | ||
void getReviewsTest() throws Exception { | ||
mockMvc.perform(MockMvcRequestBuilders.get("/establishment/review?establishmentId=100")) | ||
.andExpect(status().is2xxSuccessful()) | ||
.andExpect(responseFromPath("http/response/review/review_list_response.json")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<dataset> | ||
<review | ||
id="10" | ||
establishment_id="100" | ||
score="5" | ||
text="Отличное заведение!" | ||
username="Петров" | ||
date="2024-02-12" | ||
answer="Спасибо за отзыв! Помогаете нам расти и становиться лучше!" | ||
/> | ||
|
||
<review | ||
id="20" | ||
establishment_id="100" | ||
score="2" | ||
text="Это отвратительно!" | ||
username="Лера" | ||
date="2024-03-12" | ||
answer="Мы вас ненавидим!" | ||
/> | ||
</dataset> |
17 changes: 17 additions & 0 deletions
17
src/test/resources/http/response/review/review_list_response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"result": [ | ||
{ | ||
"username": "Петров", | ||
"text": "Отличное заведение!", | ||
"score": 5, | ||
"answer": "Спасибо за отзыв! Помогаете нам расти и становиться лучше!" | ||
}, | ||
{ | ||
"username": "Лера", | ||
"text": "Это отвратительно!", | ||
"score": 2, | ||
"answer": "Мы вас ненавидим!" | ||
} | ||
], | ||
"exception": null | ||
} |