Class UserControllerTest

java.lang.Object
com.cis.gorecipe.BaseTest
com.cis.gorecipe.controller.UserControllerTest

class UserControllerTest extends BaseTest
This class houses the unit/integration tests for all RecipeController API endpoints
  • Field Details

    • logger

      private final org.slf4j.Logger logger
    • userController

      @Autowired UserController userController
    • mockUsers

      private User[] mockUsers
  • Constructor Details

    • UserControllerTest

      UserControllerTest()
  • Method Details

    • setup

      @BeforeEach public void setup()
    • testCreateNewUser

      @Test @DirtiesContext public void testCreateNewUser() throws Exception
      Test whether a new user (with complete and valid data) can be created
      Throws:
      Exception
    • testCreateNewUserWithMissingData

      @Test @DirtiesContext public void testCreateNewUserWithMissingData() throws Exception
      Test whether the API will reject an attempt to create a user with invalid data
      Throws:
      Exception
    • testCreateUserWithNonUniqueData

      @Test @DirtiesContext public void testCreateUserWithNonUniqueData() throws Exception
      Test whether the API will reject an attempt to create a user that contains non-unique information such as an already used email or username
      Throws:
      Exception
    • testDeleteUser

      @Test @DirtiesContext public void testDeleteUser() throws Exception
      Test whether a user that exists can be successfully deleted
      Throws:
      Exception
    • testDeleteUserDoesNotExist

      @Test @DirtiesContext public void testDeleteUserDoesNotExist() throws Exception
      Test whether the API will reject an attempt to delete a user that does not exist
      Throws:
      Exception
    • testUpdateUser

      @Test @DirtiesContext public void testUpdateUser() throws Exception
      Test whether a user that exists can have their information (e.g. first name or email) updated
      Throws:
      Exception
    • testUpdateUserDoesNotExist

      @Test @DirtiesContext public void testUpdateUserDoesNotExist() throws Exception
      Test whether the API will reject an attempt to update a user that does not exist
      Throws:
      Exception
    • testGetUser

      @Test @DirtiesContext public void testGetUser() throws Exception
      Test whether the data of user that exists can be retrieved
      Throws:
      Exception
    • testGetUserDoesNotExist

      @Test @DirtiesContext public void testGetUserDoesNotExist() throws Exception
      Test whether the API will reject an attempt to retrieve the data of a user that does not exist
      Throws:
      Exception
    • testLoginSuccess

      @Test @DirtiesContext public void testLoginSuccess() throws Exception
      Test whether the API will return a user's data when they have successfully logged in
      Throws:
      Exception
    • testLoginFailure

      @Test @DirtiesContext public void testLoginFailure() throws Exception
      Test whether the API will reject an attempt to log in with an incorrect password
      Throws:
      Exception
    • testLoginWithUserDoesNotExist

      @Test @DirtiesContext public void testLoginWithUserDoesNotExist() throws Exception
      Test whether the API will reject an attempt to log in with a username that does not belong to any account
      Throws:
      Exception
    • testGetSavedRecipes

      @Test @DirtiesContext public void testGetSavedRecipes() throws Exception
      Test whether a user's saved recipes can be retrieved
      Throws:
      Exception
    • testGetSavedRecipesUserDoesNotExist

      @Test @DirtiesContext public void testGetSavedRecipesUserDoesNotExist() throws Exception
      Test whether the API will reject an attempt to retrieve recipes from an account that does not exist
      Throws:
      Exception
    • testSaveRecipeToAccount

      @Test @DirtiesContext public void testSaveRecipeToAccount() throws Exception
      Test whether a recipe that exists can be saved to a user account that exists
      Throws:
      Exception
    • testSaveRecipeToAccountUserDoesNotExist

      @Test @DirtiesContext public void testSaveRecipeToAccountUserDoesNotExist() throws Exception
      Test whether the API will reject an attempt to save a recipe that exists to an account that does not exist
      Throws:
      Exception
    • testSaveRecipeDoesNotExistToAccount

      @Test @DirtiesContext public void testSaveRecipeDoesNotExistToAccount() throws Exception
      Test whether the API will reject an attempt to save a recipe that does not exist to an account that does exist
      Throws:
      Exception
    • testAddDietaryRestrictionToAccount

      @Test @DirtiesContext public void testAddDietaryRestrictionToAccount() throws Exception
      Test whether a dietary restriction can be added to an account
      Throws:
      Exception
    • testAddDietaryRestrictionToAccountUserDoesNotExist

      @Test @DirtiesContext public void testAddDietaryRestrictionToAccountUserDoesNotExist() throws Exception
      Test whether the API will reject an attempt to add a dietary restriction to an account that does not exist
      Throws:
      Exception
    • testAddDietaryRestrictionDoesNotExistToAccount

      @Test @DirtiesContext public void testAddDietaryRestrictionDoesNotExistToAccount() throws Exception
      Test whether the API will reject an attempt to add a dietary restriction that does not exist to an account that does exist
      Throws:
      Exception
    • testRemoveDietaryRestrictionFromAccount

      @Test @DirtiesContext public void testRemoveDietaryRestrictionFromAccount() throws Exception
      Test whether a dietary restriction can be removed from an account
      Throws:
      Exception
    • testRemoveDietaryRestrictionFromAccountUserDoesNotExist

      @Test @DirtiesContext public void testRemoveDietaryRestrictionFromAccountUserDoesNotExist() throws Exception
      Test whether the API will reject an attempt to remove a dietary restriction from an account that does not exist
      Throws:
      Exception
    • testRemoveDietaryRestrictionDoesNotExistFromAccount

      @Test @DirtiesContext public void testRemoveDietaryRestrictionDoesNotExistFromAccount() throws Exception
      Test whether the API will reject an attempt to remove a dietary restriction that does not exist from an account that does exist
      Throws:
      Exception