OlhenShu / GreenCityProjectStage

0 stars 0 forks source link

Create unit test to HabitAssignController.java #214

Open OlhenShu opened 11 months ago

OlhenShu commented 11 months ago

Create unit test to GreenCityMVP project to src/main/java/greencity/controller/HabitAssignController.java

Description: Develop a set of unit tests for the HabitAssignController class to ensure its proper functioning. The tests should verify the correctness of request handling and responses, especially focusing on interactions with the HabitAssignService.

Input Data:

URL for accessing habit assignment (/habit/assign). JSON string for test data. Tests and their Expected Outcomes:

Test the assignment of a habit.

Expected: status().isCreated() getHabitAssign: Retrieve a habit assignment.

Expected: status().isOk() updateAssignByHabitAssignId: Update status by habit assignment ID.

Expected: status().isOk() updateHabitAssignDurationTest: Update habit assignment duration.

Expected: status().isOk() enrollHabit: Enroll in a habit.

Expected: status().isOk() unenrollHabit: Unenroll from a habit.

Expected: status().isOk() getHabitAssignBetweenDatesTest: Get habit assignments between specific dates.

Expected: status().isOk() cancelHabitAssign: Cancel a habit assignment.

Expected: status().isOk() getHabitAssignByHabitIdTest: Retrieve habit assignment by habit ID.

Expected: status().isOk() getCurrentUserHabitAssignsByIdAndAcquired: Get current user habit assignments.

Expected: status().isOk() deleteHabitAssignTest: Delete a habit assignment. Expected: status().isOk() updateShoppingListStatus: Update shopping list status. Expected: status().isOk() assignCustom: Assign custom properties to a habit. Expected: status().isCreated() getAllHabitAssignsByHabitIdAndAcquired: Get all habit assignments by habit ID and acquired status. Expected: status().isOk() getInprogressHabitAssignOnDate: Get in-progress habit assignments on a specific date. Expected: status().isOk() getUsersHabitByHabitId: Get users' habits by habit ID. Expected: status().isOk() getUserAndCustomListByUserIdAndHabitId: Retrieve lists for users by user ID and habit ID. Expected: status().isOk() getUserAndCustomListByUserIdAndHabitIdAndLocale: Retrieve lists for users by user ID, habit ID, and locale. Expected: status().isOk() getListOfUserAndCustomShoppingListsInprogress: Get lists of user and custom shopping items in progress. Expected: status().isOk() updateUserAndCustomShoppingLists: Update lists of user and custom shopping items. Expected: status().isOk() updateProgressNotificationHasDisplayedTest: Update the status of displayed progress notifications. Expected: status().isOk()

Acceptance Criteria:

Related to stories #98, #101, #102, #104, #134, #135