Skip to content

Unit Test Reports

Zeynep Baydemir edited this page Dec 29, 2023 · 2 revisions

Unit Test Coverage

test-coverage1 test-coverage

Unit Test Reports

Auth Service

1. testRegisterUser Method:

Test Case: Registering a New User

  • Functionality Tested: Registering a new user with valid credentials.
  • Tested Cases:
    • Valid registration request with a unique username and email.
  • Expected Outcome: The new user should be successfully registered with the provided credentials.

2. testLoginUser Method:

Test Case: Logging In a User

  • Functionality Tested: Logging in a user with valid credentials.
  • Tested Cases:
    • Valid login request with correct email and password.
  • Expected Outcome: The user should be successfully logged in, and a valid token should be generated.

3. testLoginUserInvalidPassword Method:

Test Case: Logging In with Invalid Password

  • Functionality Tested: Attempting to log in with an incorrect password.
  • Tested Cases:
    • Valid login request with an incorrect password.
  • Expected Outcome: BadRequestException should be thrown.

4. testLoginUserNotFound Method:

Test Case: Logging In with Non-Existent User

  • Functionality Tested: Attempting to log in with the email of a non-existent user.
  • Tested Cases:
    • Valid login request with an email that does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

User Service

1. testGetAllUsers Method:

Test Case: Retrieving All Users

  • Functionality Tested: Retrieving a list of all users.
  • Tested Cases:
    • Request to get all users.
  • Expected Outcome: A list containing all users should be returned.

2. testGetAllUsersWithFilter Method:

Test Case: Retrieving Users with Filtering

  • Functionality Tested: Retrieving a list of users based on filtering criteria.
  • Tested Cases:
    • Request to get users with a specific username filter.
  • Expected Outcome: A list containing users matching the filter criteria should be returned.

3. testGetUserById Method:

Test Case: Retrieving a User by ID

  • Functionality Tested: Retrieving a user by their unique identifier.
  • Tested Cases:
    • Request to get a user by a specific ID.
  • Expected Outcome: The user with the specified ID should be returned.

4. testDeleteUserById Method:

Test Case: Deleting a User by ID

  • Functionality Tested: Deleting a user by their unique identifier.
  • Tested Cases:
    • Request to delete a user by a specific ID.
  • Expected Outcome: The user with the specified ID should be successfully marked as deleted.

5. testGetUserByEmail Method:

Test Case: Retrieving a User by Email

  • Functionality Tested: Retrieving a user by their email address.
  • Tested Cases:
    • Request to get a user by a specific email address.
  • Expected Outcome: The user with the specified email address should be returned.

Game Service

1. testCreateGame Method:

Test Case: Creating a Game

  • Functionality Tested: Creating a new game and saving it in the repository.
  • Tested Cases:
    • Valid request with specified game details and tags.
  • Expected Outcome: The game should be successfully created and saved, and associated tags should be linked to the game.

2. testGetGameTags Method:

Test Case: Retrieving Tags of a Game

  • Functionality Tested: Retrieving all tags associated with a specified game.
  • Tested Cases:
    • Game exists, and it has associated tags.
  • Expected Outcome: The list of tags associated with the specified game should be returned.

3. testAddGameTag Method:

Test Case: Adding a Tag to a Game

  • Functionality Tested: Adding a new tag to an existing game.
  • Tested Cases:
    • Valid request with a specified game and tag.
  • Expected Outcome: The tag should be successfully added to the specified game.

4. testRemoveGameTag Method:

Test Case: Removing a Tag from a Game

  • Functionality Tested: Removing an existing tag from an existing game.
  • Tested Cases:
    • Valid request with a specified game and tag.
  • Expected Outcome: The tag should be successfully removed from the specified game.

5. testRecommendationByGameId Method:

Test Case: Generating Game Recommendations Based on a Game

  • Functionality Tested: Generating a set of recommended games based on a specified game.
  • Tested Cases:
    • Game exists, and similar games are found in the database.
  • Expected Outcome: A set of recommended games should be returned based on the similarity score.

6. testGetGameDetailWhenGameExists Method:

Test Case: Retrieving Game Details When Game Exists

  • Functionality Tested: Retrieving detailed information about a game when it exists.
  • Tested Cases:
    • Game with the specified ID exists.
  • Expected Outcome: Detailed information about the specified game should be returned.

7. testGetGameByNameWhenGameExists Method:

Test Case: Retrieving Game Details by Name When Game Exists

  • Functionality Tested: Retrieving detailed information about a game by name when it exists.
  • Tested Cases:
    • Game with the specified name exists.
  • Expected Outcome: Detailed information about the specified game should be returned.

8. testGetRecommendedGames Method:

Test Case: Retrieving Recommended Games for a User

  • Functionality Tested: Retrieving a list of recommended games for a specified user.
  • Tested Cases:
    • User exists, profile exists, and recommended games are found.
  • Expected Outcome: A list of recommended games for the specified user should be returned.

9. testGetRecommendedGamesGuest Method:

Test Case: Retrieving Recommended Games for a Guest User

  • Functionality Tested: Retrieving a list of recommended games for a guest user.
  • Tested Cases:
    • Recommended games are found for guest users.
  • Expected Outcome: A list of recommended games for guest users should be returned.

10. testEditGame Method:

Test Case: Editing Game Details

  • Functionality Tested: Editing details of an existing game.
  • Tested Cases:
    • Game with the specified ID exists.
    • Game details are successfully updated.
  • Expected Outcome: The specified game's details should be successfully updated.

11. testEditGameWhenGameNotExists Method:

Test Case: Editing Game Details When Game Does Not Exist

  • Functionality Tested: Attempting to edit details of a non-existent game.
  • Tested Cases:
    • Game with the specified ID does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

12. testDeleteGameWhenGameExists Method:

Test Case: Deleting an Existing Game

  • Functionality Tested: Deleting an existing game.
  • Tested Cases:
    • Game with the specified ID exists.
  • Expected Outcome: The specified game should be successfully marked as deleted.

13. testDeleteGameWhenGameNotExists Method:

Test Case: Deleting a Non-Existent Game

  • Functionality Tested: Attempting to delete a game that does not exist.
  • Tested Cases:
    • Game with the specified ID does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

14. testChangePromotionStatusOfGame Method:

Test Case: Changing Promotion Status of a Game

  • Functionality Tested: Changing the promotion status of an existing game.
  • Tested Cases:
    • Game with the specified ID exists.
  • Expected Outcome: The promotion status of the specified game should be successfully toggled.

15. testChangePromotionStatusOfGameWhenGameNotExists Method:

Test Case: Changing Promotion Status of a Non-Existent Game

  • Functionality Tested: Attempting to change the promotion status of a game that does not exist.
  • Tested Cases:
    • Game with the specified ID does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

16. testCalculateSimilarityScore Method:

Test Case: Calculating Similarity Score Between Games

  • Functionality Tested: Calculating the similarity score between two games based on their tags.
  • Tested Cases:
    • Games with specified tags are provided.
  • Expected Outcome: The similarity score between the two specified games should be calculated.

17. testGetGames Method:

Test Case: Retrieving Filtered List of Games

  • Functionality Tested: Retrieving a filtered list of games based on specified criteria.
  • Tested Cases:
    • Valid filter criteria provided.
  • Expected Outcome: A filtered list of games based on the specified criteria should be returned.

18. testGetAllGames Method:

Test Case: Retrieving All Games

  • Functionality Tested: Retrieving all games based on specified criteria.
  • Tested Cases:
    • Valid filter criteria provided.
  • Expected Outcome: All games based on the specified criteria should be returned.

Tag Service

1. testGetAllTags Method:

Test Case: Retrieving All Tags

  • Functionality Tested: Retrieving all tags based on specified criteria.
  • Tested Cases:
    • Valid filter criteria provided.
  • Expected Outcome: All tags based on the specified criteria should be returned.

2. testGetTagById Method:

Test Case: Retrieving Tag by ID

  • Functionality Tested: Retrieving a tag by its ID.
  • Tested Cases:
    • Tag with the specified ID exists.
  • Expected Outcome: The tag with the specified ID should be returned.

3. testCreateTag Method:

Test Case: Creating a Tag

  • Functionality Tested: Creating a new tag and saving it in the repository.
  • Tested Cases:
    • Valid request with a specified tag name.
    • Tag with the same name does not exist.
  • Expected Outcome: The tag should be successfully created and saved in the repository.

4. testCreateTagWithExistingName Method:

Test Case: Creating a Tag with an Existing Name

  • Functionality Tested: Attempting to create a tag with a name that already exists.
  • Tested Cases:
    • Tag with the same name already exists.
  • Expected Outcome: BadRequestException should be thrown.

5. testUpdateTag Method:

Test Case: Updating Tag Details

  • Functionality Tested: Updating details of an existing tag.
  • Tested Cases:
    • Tag with the specified ID exists.
  • Expected Outcome: The specified tag's details should be successfully updated.

6. testUpdateTagNotFound Method:

Test Case: Updating Tag Details When Tag Does Not Exist

  • Functionality Tested: Attempting to update details of a non-existent tag.
  • Tested Cases:
    • Tag with the specified ID does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

Forum Service

1. banUser Method Tests:

Test Case 1: banUser_SuccessfullyBanned

  • Functionality Tested: Banning a user in a forum successfully.
  • Tested Cases:
    • Forum exists, user exists in the forum, and banning is successful.
  • Expected Outcome: The user should be successfully banned in the specified forum.

Test Case 2: banUser_ForumNotFound

  • Functionality Tested: Handling the case when the specified forum doesn't exist.
  • Tested Cases:
    • Forum does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

2. unbanUser Method Tests:

Test Case 3: unbanUser_SuccessfullyUnbanned

  • Functionality Tested: Unbanning a user in a forum.
  • Tested Cases:
    • Forum exists, user is banned in the forum, and unbanning is successful.
  • Expected Outcome: The user should be successfully unbanned in the specified forum.

Test Case 4: unbanUser_ForumNotFound

  • Functionality Tested: Handling the case when the specified forum doesn't exist.
  • Tested Cases:
    • Forum does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

Group Service

1. createGroup Method Tests:

Test Case 1: createGroup_Success

  • Functionality Tested: Creating a group.
  • Tested Cases:
    • Group title is unique.
    • Tags exist and are associated with the group.
    • Game exists and is associated with the group.
  • Expected Outcome: The group should be successfully created with the specified details.

Test Case 2: createGroup_GroupWithTitleExists_ThrowsBadRequestException

  • Functionality Tested: Handling the case when the group title already exists.
  • Tested Cases:
    • Group with the same title already exists.
  • Expected Outcome: BadRequestException should be thrown.

Test Case 3: createGroup_TagNotFound_ThrowsResourceNotFoundException

  • Functionality Tested: Handling the case when a specified tag is not found.
  • Tested Cases:
    • Tag specified in the request is not found.
  • Expected Outcome: ResourceNotFoundException should be thrown.

2. getAllGroups Method Tests:

Test Case 4: testGetAllGroups

  • Functionality Tested: Retrieving all groups based on filter criteria.
  • Tested Cases:
    • Filter by title, sort by creation date, descending order, excluding deleted groups.
  • Expected Outcome: List of groups should be retrieved based on the specified filter.

3. getGroupById Method Tests:

Test Case 5: testGetGroupById

  • Functionality Tested: Retrieving detailed information about a group by its ID.
  • Tested Cases:
    • Group ID exists, user is a member, and user has a profile.
  • Expected Outcome: Detailed information about the group should be retrieved.

Test Case 6: testGetGroupByIdNotFound

  • Functionality Tested: Handling the case when the specified group ID is not found.
  • Tested Cases:
    • Group with the specified ID does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

4. deleteGroup Method Tests:

Test Case 7: testDeleteGroupByTitle

  • Functionality Tested: Deleting a group by its title.
  • Tested Cases:
    • Group with the specified title exists.
  • Expected Outcome: The group should be successfully deleted.

Test Case 8: testDeleteGroupNotFound

  • Functionality Tested: Handling the case when the specified group is not found.
  • Tested Cases:
    • Group with the specified title does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

5. updateGroup Method Tests:

Test Case 9: testUpdateGroup

  • Functionality Tested: Updating details of a group.
  • Tested Cases:
    • Group with the specified ID exists.
  • Expected Outcome: The group details should be successfully updated.

Test Case 10: testUpdateGroupNotFound

  • Functionality Tested: Handling the case when the specified group is not found.
  • Tested Cases:
    • Group with the specified ID does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

Test Case 11: testUpdateGroupInvalidQuota

  • Functionality Tested: Handling the case when the new quota is invalid.
  • Tested Cases:
    • Quota is less than the current number of members.
  • Expected Outcome: BadRequestException should be thrown.

6. joinGroup Method Tests:

Test Case 12: testJoinGroup_Success

  • Functionality Tested: Joining a public group.
  • Tested Cases:
    • Group with the specified ID is public.
  • Expected Outcome: User should successfully join the group.

Test Case 13: testJoinPrivateGroup

  • Functionality Tested: Handling the case when attempting to join a private group.
  • Tested Cases:
    • Group with the specified ID is private.
  • Expected Outcome: BadRequestException should be thrown.

Test Case 14: testJoinFullGroup

  • Functionality Tested: Handling the case when attempting to join a full group.
  • Tested Cases:
    • Group with the specified ID has reached its quota.
  • Expected Outcome: BadRequestException should be thrown.

7. leaveGroup Method Tests:

Test Case 15: testLeaveGroup_Success

  • Functionality Tested: Leaving a group.
  • Tested Cases:
    • User is a member of the group.
  • Expected Outcome: User should successfully leave the group.

Test Case 16: testLeaveGroupNotFound

  • Functionality Tested: Handling the case when the specified group ID is not found.
  • Tested Cases:
    • Group with the specified ID does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

8. applyGroup Method Tests:

Test Case 17: testApplyGroup

  • Functionality Tested: Applying to join a group.
  • Tested Cases:
    • Group with the specified ID is private.
  • Expected Outcome: User should successfully apply to join the group.

Test Case 18: testApplyGroupNotFound

  • Functionality Tested: Handling the case when the specified group ID is not found.
  • Tested Cases:
    • Group with the specified ID does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

Test Case 19: testApplyGroupPublicGroup

  • Functionality Tested: Handling the case when attempting to apply to join a public group.
  • Tested Cases:
    • Group with the specified ID is public.
  • Expected Outcome: BadRequestException should be thrown.

Test Case 20: testApplyGroupAlreadyMember

  • Functionality Tested: Handling the case when the user is already a member of the group.
  • Tested Cases:
    • User is already a member of the group.
  • Expected Outcome: BadRequestException should be thrown.

Test Case 21: testApplyGroupBannedMember

  • Functionality Tested: Handling the case when the user is banned from the group.
  • Tested Cases:
    • User is banned from the group.
  • Expected Outcome: BadRequestException should be thrown.

Test Case 22: testApplyGroupPendingRequest

  • Functionality Tested: Handling the case when the user already has a pending application for the group.
  • Tested Cases:
    • User already has a pending application for the group.
  • Expected Outcome: BadRequestException should be thrown.

Comment Service

1. createComment Method Tests:

Test Case 1: createComment_SuccessfulCreation

  • Functionality Tested: Creating a comment on a post successfully.
  • Tested Cases:
    • Post exists, profile exists, and comment creation is successful.
  • Expected Outcome: A new comment should be successfully created and saved.

Test Case 2: createComment_PostNotFound

  • Functionality Tested: Handling the case when the specified post doesn't exist.
  • Tested Cases:
    • Post does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

2. replyComment Method Tests:

Test Case 3: replyComment_SuccessfulReply

  • Functionality Tested: Replying to a comment on a post.
  • Tested Cases:
    • Parent comment exists, profile exists, and reply comment creation is successful.
  • Expected Outcome: A reply to the comment should be successfully created and saved.

3. editComment Method Tests:

Test Case 4: editComment_SuccessfulEdit

  • Functionality Tested: Editing an existing comment.
  • Tested Cases:
    • Comment exists and edit operation is successful.
  • Expected Outcome: The comment should be successfully edited and updated.

4. deleteComment Method Tests:

Test Case 5: deleteComment_SuccessfulDeletion

  • Functionality Tested: Deleting an existing comment.
  • Tested Cases:
    • Comment exists and deletion operation is successful.
  • Expected Outcome: The comment should be successfully marked as deleted.

5. getUserCommentList Method Tests:

Test Case 6: getUserCommentList_SuccessfulRetrieval

  • Functionality Tested: Retrieving a list of comments made by a user.
  • Tested Cases:
    • User has made comments and retrieval operation is successful.
  • Expected Outcome: A list of comments made by the user should be successfully retrieved.

Review Service

1. GetAllReviews Method Tests:

Test Case 1: GetAllReviews_ReturnsAllReviews

  • Functionality Tested: Retrieving all reviews based on provided filters.
  • Tested Cases:
    • Filters set for gameId, reviewedBy, withDeleted, sortBy, and sortDirection.
    • Valid return of review list from the repository.
  • Expected Outcome: A non-null list of GetAllReviewsResponseDto is returned.

2. GetReview Method Tests:

Test Case 2: GetReview_ReturnsReview

  • Functionality Tested: Retrieving a single review by its ID.
  • Tested Cases:
    • Review with the specified ID exists.
  • Expected Outcome: A non-null GetAllReviewsResponseDto corresponding to the given ID is returned.

Test Case 3: GetReview_ReviewNotFound

  • Functionality Tested: Handling the case when the specified review ID does not exist.
  • Tested Cases:
    • Review with the specified ID does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

3. AddReview Method Tests:

Test Case 4: AddReview_SuccessfullyAdded

  • Functionality Tested: Successfully adding a new review.
  • Tested Cases:
    • Valid review data is provided.
  • Expected Outcome: The review should be successfully added and returned.

4. UpdateReview Method Tests:

Test Case 5: UpdateReview_SuccessfullyUpdated

  • Functionality Tested: Successfully updating an existing review.
  • Tested Cases:
    • Review exists and valid update data is provided.
  • Expected Outcome: Review should be successfully updated.

Test Case 6: UpdateReview_ReviewNotFound

  • Functionality Tested: Handling the case when the review to update is not found.
  • Tested Cases:
    • Review with the specified ID does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

5. DeleteReview Method Tests:

Test Case 7: DeleteReview_SuccessfullyDeleted

  • Functionality Tested: Successfully deleting a review.
  • Tested Cases:
    • Review exists for the given ID.
  • Expected Outcome: Review should be successfully deleted.

Test Case 8: DeleteReview_ReviewNotFound

  • Functionality Tested: Handling the case when the review to delete is not found.
  • Tested Cases:
    • Review with the specified ID does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

Profile Service

1. Edit Profile Method Tests:

Test Case 1: editProfile_SuccessfulEdit

  • Functionality Tested: Editing a user's profile successfully.
  • Tested Cases:
    • Profile exists and edit operation is successful.
  • Expected Outcome: The profile should be successfully updated.

Test Case 2: editProfile_ProfileNotFound

  • Functionality Tested: Handling the case when the specified profile doesn't exist.
  • Tested Cases:
    • Profile does not exist.
  • Expected Outcome: ResourceNotFoundException should be thrown.

2. Add Game to Profile Method Tests:

Test Case 3: addGameToProfile_SuccessfulAddition

  • Functionality Tested: Adding a game to a user's profile.
  • Tested Cases:
    • Profile and game exist, and addition operation is successful.
  • Expected Outcome: The game should be successfully added to the profile.

3. Remove Game from Profile Method Tests:

Test Case 4: removeGameFromProfile_SuccessfulRemoval

  • Functionality Tested: Removing a game from a user's profile.
  • Tested Cases:
    • Profile and game exist, and removal operation is successful.
  • Expected Outcome: The game should be successfully removed from the profile.

4. Get Profile Method Tests:

Test Case 5: getProfile_PrivateProfileAccessDenied

  • Functionality Tested: Accessing a private profile by a non-owner and non-admin user.
  • Tested Cases:
    • Profile is private, and accessed by a non-owner and non-admin user.
  • Expected Outcome: BadRequestException should be thrown.

Test Case 6: getProfile_SuccessfulRetrieval

  • Functionality Tested: Successfully retrieving a public profile.
  • Tested Cases:
    • Profile is public and accessible.
  • Expected Outcome: The profile should be successfully retrieved.

Achievement Service

1. createAchievement Method Tests:

Test Case 1: testCreateAchievement_GameAchievement_Success

  • Functionality Tested: Creating a game achievement successfully.
  • Tested Cases:
    • Game exists. No existing achievements with the same title.
  • Expected Outcome: The game achievement should be successfully created.

Test Case 2: testCreateAchievement_MetaAchievement_Success

  • Functionality Tested: Creating a meta achievement successfully.
  • Tested Cases:
    • No existing achievements with the same title.
  • Expected Outcome: The meta achievement should be successfully created.

2. updateAchievement Method Tests:

Test Case 3: testUpdateAchievement_Success

  • Functionality Tested: Updating an achievement successfully.
  • Tested Cases:
    • Achievement exists, and is not deleted.
  • Expected Outcome: The achievement should be successfully updated with the new fields.

3. deleteAchievement Method Tests:

Test Case 4: testDeleteAchievementById_Success

  • Functionality Tested: Deleting an achievement by ID successfully.
  • Tested Cases:
    • Achievement exists, and is not deleted.
  • Expected Outcome: The achievement should be successfully marked as deleted.

Test Case 5: testDeleteAchievement_NotFoundById

  • Functionality Tested: Handling the case when the achievement is not found by ID.
  • Tested Cases:
    • Achievement does not exist or already deleted.
  • Expected Outcome: ResourceNotFoundException should be thrown.

Test Case 6: testDeleteAchievementByNameAndGame_Success

  • Functionality Tested: Deleting an achievement by name and game successfully.
  • Tested Cases:
    • Achievement exists, game exists, and the achievement is linked to the given game.
  • Expected Outcome: The achievement should be successfully marked as deleted.

4. grantAchievement Method Tests:

Test Case 7: testGrantAchievement_Success

  • Functionality Tested: Granting an achievement successfully.
  • Tested Cases:
    • Achievement and user exist.
  • Expected Outcome: The achievement should be successfully granted to the user.

5. getGameAchievements Method Tests:

Test Case 8: testGetGameAchievements_Success

  • Functionality Tested: Retrieving achievements for a game successfully.
  • Tested Cases:
    • Game exists.
  • Expected Outcome: The list of achievements for the specified game should be retrieved successfully.

Post Service

1. testGetPostList_Success Method:

Test Case: Retrieving List of Posts

  • Functionality Tested: Retrieving a list of posts based on filter criteria.
  • Tested Cases:
    • Request to get a list of posts with a specific filter.
  • Expected Outcome: A list containing posts based on the filter criteria should be returned.

2. testGetPostById_Success Method:

Test Case: Retrieving Post by ID

  • Functionality Tested: Retrieving a post by its unique identifier.
  • Tested Cases:
    • Request to get a post by a specific ID.
    • Request to get a post with a non-existing ID (Not Found).
  • Expected Outcome: The post with the specified ID should be returned. If the post ID does not exist, a ResourceNotFoundException should be thrown.

3. testCreatePost_Success Method:

Test Case: Creating a Post

  • Functionality Tested: Creating a new post.
  • Tested Cases:
    • Request to create a post with valid data.
  • Expected Outcome: The post should be successfully created and returned.

4. testEditPost_Success Method:

Test Case: Editing a Post

  • Functionality Tested: Editing an existing post.
  • Tested Cases:
    • Request to edit a post with valid data.
  • Expected Outcome: The post should be successfully edited and returned.

5. testDeletePost_Success Method:

Test Case: Deleting a Post

  • Functionality Tested: Deleting an existing post.
  • Tested Cases:
    • Request to delete a post with a valid ID.
  • Expected Outcome: The post should be successfully marked as deleted and returned.

6. testGetUserPostList_Success Method:

Test Case: Retrieving User's Post List

  • Functionality Tested: Retrieving a list of posts belonging to a specific user.
  • Tested Cases:
    • Request to get a list of posts for a specific user.
  • Expected Outcome: A list containing posts belonging to the specified user should be returned.

7. testGetCommentList_Success Method:

Test Case: Retrieving Post Comments

  • Functionality Tested: Retrieving comments associated with a specific post.
  • Tested Cases:
    • Request to get comments for a specific post.
  • Expected Outcome: A list containing comments for the specified post should be returned.

8. testGetHomePagePostsOfUser_Success Method:

Test Case: Retrieving Homepage Posts for a User

  • Functionality Tested: Retrieving posts for a user's homepage based on filtering criteria.
  • Tested Cases:
    • Request to get homepage posts for a user with valid data.
  • Expected Outcome: A list containing homepage posts for the specified user should be returned.

9. testGetHomePagePostsOfUser_Success_Group_Forum Method:

Test Case: Retrieving Homepage Posts for a User with Group Forum

  • Functionality Tested: Retrieving posts for a user's homepage with a group forum.
  • Tested Cases:
    • Request to get homepage posts for a user with a group forum and specific sorting criteria.
  • Expected Outcome: A list containing homepage posts for the specified user should be returned, considering the group forum and sorting criteria.

10. testGetHomePagePostsOfGuest_Success Method:

Test Case: Retrieving Homepage Posts for a Guest User

  • Functionality Tested: Retrieving posts for a guest user's homepage based on filtering criteria.
  • Tested Cases:
    • Request to get homepage posts for a guest user with valid data.
  • Expected Outcome: A list containing homepage posts for a guest user should be returned.

11. testGetHomePagePostsOfGuest_Success_Group_Forum Method:

Test Case: Retrieving Homepage Posts for a Guest User with Group Forum

  • Functionality Tested: Retrieving posts for a guest user's homepage with a group forum.
  • Tested Cases:
    • Request to get homepage posts for a guest user with a group forum and specific sorting criteria.
  • Expected Outcome: A list containing homepage posts for a guest user should be returned, considering the group forum and sorting criteria.

12. testGetHomepagePosts_UserNotFound Method:

Test Case: Handling User Not Found Exception

  • Functionality Tested: Handling the scenario when the user is not found during the retrieval of homepage posts.
  • Tested Cases:
    • Request to get homepage posts for a user, but the user is not found.
  • Expected Outcome: A ResourceNotFoundException should be thrown when the user is not found.

13. testGetHomepagePosts_Guest Method:

Test Case: Retrieving Homepage Posts for a Guest User

  • Functionality Tested: Retrieving homepage posts for a guest user.
  • Tested Cases:
    • Request to get homepage posts for a guest user without a user ID.
  • Expected Outcome: Homepage posts for a guest user should be retrieved without interacting with the user repository.

Vote Service

1. testGetAllVotes Method:

Test Case: Retrieving All Votes

  • Functionality Tested: Retrieving all votes based on filter criteria.
  • Tested Cases:
    • Request to get all votes with a specific filter.
  • Expected Outcome: A list containing all votes based on the filter criteria should be returned.

2. testGetVote Method:

Test Case: Retrieving a Vote by ID

  • Functionality Tested: Retrieving a vote by its unique identifier.
  • Tested Cases:
    • Request to get a vote by a specific ID.
    • Request to get a vote with a non-existing ID (Not Found).
  • Expected Outcome: The vote with the specified ID should be returned. If the vote ID does not exist, a ResourceNotFoundException should be thrown.

3. testAddVote Method:

Test Case: Adding a Vote

  • Functionality Tested: Adding a new vote.
  • Tested Cases:
    • Request to add a vote with valid data.
    • Request to add a vote for a review, comment, and post with different scenarios.
  • Expected Outcome: The vote should be successfully added and returned. Additional scenarios for adding votes for different types (review, comment, post) should be considered.

4. testAddVoteResourceNotFound Method:

Test Case: Handling Resource Not Found Exception on Adding a Vote

  • Functionality Tested: Handling the scenario when the resource for which the vote is being added is not found.
  • Tested Cases:
    • Request to add a vote for a non-existing resource.
  • Expected Outcome: A ResourceNotFoundException should be thrown when the resource is not found.

5. testDeleteVote Method:

Test Case: Deleting a Vote

  • Functionality Tested: Deleting an existing vote.
  • Tested Cases:
    • Request to delete a vote with a valid ID.
    • Request to delete a non-existing vote (Not Found).
  • Expected Outcome: The vote should be successfully deleted, and a boolean result should be returned. If the vote ID does not exist, a ResourceNotFoundException should be thrown.

6. testDeleteVoteResourceNotFound Method:

Test Case: Handling Resource Not Found Exception on Deleting a Vote

  • Functionality Tested: Handling the scenario when the vote to be deleted is not found.
  • Tested Cases:
    • Request to delete a non-existing vote.
  • Expected Outcome: A ResourceNotFoundException should be thrown when the vote is not found.

Character Service

1. createCharacter Method Tests:

Test Case 1: testCreateCharacterWithValidData

  • Functionality Tested: Creating a character with valid data.
  • Tested Cases:
    • Valid game ID provided.
  • Expected Outcome: The character should be successfully created.

Test Case 2: testCreateCharacterWithEmptyGames

  • Functionality Tested: Handling the case when the games list is empty.
  • Tested Cases:
    • Empty games list provided.
  • Expected Outcome: BadRequestException should be thrown.

Test Case 3: testCreateCharacterWithNonExistentGame

  • Functionality Tested: Handling the case when the specified game doesn't exist.
  • Tested Cases:
    • Non-existent game ID provided.
  • Expected Outcome: ResourceNotFoundException should be thrown.

Test Case 4: testCreateCharacterWithNullRequest

  • Functionality Tested: Handling the case when the request is null.
  • Tested Cases:
    • Null request provided.
  • Expected Outcome: NullPointerException should be thrown.

2. updateCharacter Method Tests:

Test Case 5: testUpdateCharacterWithValidData

  • Functionality Tested: Updating a character with valid data.
  • Tested Cases:
    • Valid character ID and valid update request.
  • Expected Outcome: The character should be successfully updated.

Test Case 6: testUpdateCharacterWithValidBlankData

  • Functionality Tested: Updating a character with valid blank data.
  • Tested Cases:
    • Valid character ID and update request with blank fields.
  • Expected Outcome: The character should be successfully updated.

Test Case 7: testUpdateCharacterNonExistentCharacter

  • Functionality Tested: Handling the case when the specified character doesn't exist.
  • Tested Cases:
    • Non-existent character ID provided.
  • Expected Outcome: ResourceNotFoundException should be thrown.

Test Case 8: testUpdateCharacterWithBlankName

  • Functionality Tested: Handling the case when the updated character has a blank name.
  • Tested Cases:
    • Blank name provided in the update request.
  • Expected Outcome: BadRequestException should be thrown.

Test Case 9: testUpdateCharacterWithBlankIcon

  • Functionality Tested: Handling the case when the updated character has a blank icon.
  • Tested Cases:
    • Blank icon provided in the update request.
  • Expected Outcome: BadRequestException should be thrown.

Test Case 10: testUpdateCharacterWithBlankDescription

  • Functionality Tested: Handling the case when the updated character has a blank description.
  • Tested Cases:
    • Blank description provided in the update request.
  • Expected Outcome: BadRequestException should be thrown.

Test Case 11: testUpdateCharacterWithEmptyGamesList

  • Functionality Tested: Handling the case when the updated character has an empty games list.
  • Tested Cases:
    • Empty games list provided in the update request.
  • Expected Outcome: BadRequestException should be thrown.

Test Case 12: testUpdateCharacterWithNonExistentGame

  • Functionality Tested: Handling the case when the updated character has a non-existent game in the games list.
  • Tested Cases:
    • Non-existent game ID provided in the update request.
  • Expected Outcome: ResourceNotFoundException should be thrown.

Test Case 13: testUpdateCharacterWithNullRequest

  • Functionality Tested: Handling the case when the update request is null.
  • Tested Cases:
    • Null update request provided.
  • Expected Outcome: NullPointerException should be thrown.

3. deleteCharacter Method Tests:

Test Case 14: testDeleteCharacterWithValidId

  • Functionality Tested: Deleting a character with a valid ID.
  • Tested Cases:
    • Valid character ID provided.
  • Expected Outcome: The character should be marked as deleted.

Test Case 15: testDeleteNonExistentCharacter

  • Functionality Tested: Handling the case when the specified character doesn't exist.
  • Tested Cases:
    • Non-existent character ID provided.
  • Expected Outcome: ResourceNotFoundException should be thrown.

Test Case 16: testDeleteCharacterAlreadyDeleted

  • Functionality Tested: Handling the case when trying to delete an already deleted character.
  • Tested Cases:
    • Character with "isDeleted" flag set to true.
  • Expected Outcome: ResourceNotFoundException should be thrown.

4. getGameCharacters Method Tests:

Test Case 17: testGetGameCharactersWithValidGameId

  • Functionality Tested: Retrieving characters for a valid game ID.
  • Tested Cases:
    • Valid game ID provided.
  • Expected Outcome: List of characters for the specified game should be returned.

Test Case 18: testGetGameCharactersWithNonExistentGameId

  • Functionality Tested: Handling the case when the specified game doesn't exist.
  • Tested Cases:
    • Non-existent game ID provided.
  • Expected Outcome: ResourceNotFoundException should be thrown.

Notification Service

1. getNotificationList Method Tests:

Test Case 1: testGetNotificationList

  • Functionality Tested: Retrieving a list of notifications based on the provided filter.
  • Tested Cases:
    • Filtering notifications by unread status.
  • Expected Outcome: The list of notifications matching the filter should be returned.

Test Case 2: testGetNotificationListWithNullFilter

  • Functionality Tested: Retrieving all notifications when the filter is null.
  • Tested Cases:
    • Null filter provided.
  • Expected Outcome: All notifications for the specified user should be returned.

2. createNotification Method Tests:

Test Case 3: testCreateNotification

  • Functionality Tested: Creating a new notification based on the provided request.
  • Tested Cases:
    • Valid request with a specified user.
  • Expected Outcome: The notification should be successfully created and saved.


💻 Meeting Notes

Cmpe 352
Cmpe 451

📝 Requirements


🪧 Diagrams


📬 Deliverables

Cmpe 352
Cmpe 451

🎇 General Contributions

Cmpe 352 Contributions

Milestone 1
Final Milestone

Cmpe 451 Contributions

Milestone 1
Milestone 2
Final Milestone

📕 Mock Up


🕵️ User Scenario



📝 RAM


📚 Research


📑 Templates


📱 Practice App

API Documentation for Practice App
Clone this wiki locally