GreenCity23 / GreenCityProject

0 stars 0 forks source link

Create unit test to ShoppingListItemController.java #256

Closed GreenCity23 closed 1 year ago

GreenCity23 commented 1 year ago

Create unit test to GreenCityMVP project to core/src/main/java/greencity/controller/ShoppingListItemController.java Description: Develop a set of unit tests for the ShoppingListItemController class to ensure its proper functioning. The tests should verify the correctness of request handling and responses.

Input Data:

URL to access shopping list items (/user/shopping-list-items). JSON string for test data.

Tests and their expected results:

  1. bulkDeleteUserShoppingListItemTest:
    Verify the response to a request for bulk deletion of user shopping list items.

    • Expected: status().isOk()
  2. updateUserShoppingListItemStatusWithLanguageParamTest:
    Verify the response to updating a shopping list item status with a specified language parameter.

    • Expected: status().isCreated()
  3. updateUserShoppingListItemStatus:
    Verify the response to updating a shopping list item's status.

    • Expected: status().isOk()
  4. updateUserShoppingListItemStatusWithoutLanguageParamTest:
    Verify the response to updating a shopping list item status without specifying a language parameter.

    • Expected: status().isCreated()
  5. saveUserShoppingListItemWithoutLanguageParamTest:
    Test saving a user's shopping list item without specifying a language parameter.

    • Expected: status().isCreated()
  6. getUserShoppingListItemsWithLanguageParamTest:
    Verify the response to a request for user shopping list items with a specified language parameter.

    • Expected: status().isOk()
  7. getUserShoppingListItemWithoutLanguageParamTest:
    Verify the response to a request for user shopping list items without specifying a language parameter.

    • Expected: status().isOk()
  8. deleteTest:
    Test deleting a user's shopping list item by item ID, user ID, and habit ID.

    • Expected: status().isOk()
  9. findAllByUserTest:
    Verify the response to a request for all items in progress for a specific user.

    • Expected: status().isOk() Acceptance Criteria:

Releted to stories #130, #131, #132, #133