Create unit test to GreenCityMVP project to core/src/main/java/greencity/controller/SearchController.java
Description:
Develop a set of unit tests for the SearchController class. The purpose is to ensure its proper functioning, especially in terms of handling search requests and providing the expected responses. The main areas to test include searching across all modules and a focused search within the eco news.
Input Data:
Base search URL: /search.
Part of the URL dedicated to eco news searches: /econews.
Query parameters for search such as searchQuery.
Tests and their expected results:
searchEverythingTest:
Purpose: Verify the system's ability to perform a generic search across all available modules.
Execution: A GET request to the /search endpoint with a given search query (Title in this case).
Expected: The HTTP status in the response should be 200 OK.
searchEcoNewsTest:
Purpose: Verify the system's ability to search specifically within the eco news.
Execution: A GET request to the /search/econews endpoint with a search query (Eco news title in this case).
Expected: The HTTP status in the response should be 200 OK.
Acceptance Criteria:
All tests pass successfully.
The code is clean and adheres to coding standards.
Dependencies are correctly mocked, and their methods are verified for calls.
Create unit test to GreenCityMVP project to core/src/main/java/greencity/controller/SearchController.java Description: Develop a set of unit tests for the SearchController class. The purpose is to ensure its proper functioning, especially in terms of handling search requests and providing the expected responses. The main areas to test include searching across all modules and a focused search within the eco news.
Input Data:
Tests and their expected results:
searchEverythingTest:
searchEcoNewsTest:
Purpose: Verify the system's ability to search specifically within the eco news.
Execution: A GET request to the /search/econews endpoint with a search query (Eco news title in this case).
Expected: The HTTP status in the response should be 200 OK. Acceptance Criteria:
All tests pass successfully.
The code is clean and adheres to coding standards.
Dependencies are correctly mocked, and their methods are verified for calls.
Test coverage should be 100%.
Related to stories #69, #70, #71, #72