Package com.cis.gorecipe.controller
Class UserControllerTest
java.lang.Object
com.cis.gorecipe.BaseTest
com.cis.gorecipe.controller.UserControllerTest
This class houses the unit/integration tests for all RecipeController API endpoints
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.slf4j.Loggerprivate User[](package private) UserControllerFields inherited from class com.cis.gorecipe.BaseTest
clarifaiService, classLoader, encoder, foodImageRepository, ingredientRepository, mockMvc, recipeRepository, s3Service, serializer, spoonacularService, userRepository, wac -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetup()voidTest whether the API will reject an attempt to add a dietary restriction that does not exist to an account that does existvoidTest whether a dietary restriction can be added to an accountvoidTest whether the API will reject an attempt to add a dietary restriction to an account that does not existvoidTest whether a new user (with complete and valid data) can be createdvoidTest whether the API will reject an attempt to create a user with invalid datavoidTest whether the API will reject an attempt to create a user that contains non-unique information such as an already used email or usernamevoidTest whether a user that exists can be successfully deletedvoidTest whether the API will reject an attempt to delete a user that does not existvoidTest whether a user's saved recipes can be retrievedvoidTest whether the API will reject an attempt to retrieve recipes from an account that does not existvoidTest whether the data of user that exists can be retrievedvoidTest whether the API will reject an attempt to retrieve the data of a user that does not existvoidTest whether the API will reject an attempt to log in with an incorrect passwordvoidTest whether the API will return a user's data when they have successfully logged invoidTest whether the API will reject an attempt to log in with a username that does not belong to any accountvoidTest whether the API will reject an attempt to remove a dietary restriction that does not exist from an account that does existvoidTest whether a dietary restriction can be removed from an accountvoidTest whether the API will reject an attempt to remove a dietary restriction from an account that does not existvoidTest whether the API will reject an attempt to save a recipe that does not exist to an account that does existvoidTest whether a recipe that exists can be saved to a user account that existsvoidTest whether the API will reject an attempt to save a recipe that exists to an account that does not existvoidTest whether a user that exists can have their information (e.g.voidTest whether the API will reject an attempt to update a user that does not existMethods inherited from class com.cis.gorecipe.BaseTest
setDatasourceProperties, setupMockMvc
-
Field Details
-
logger
private final org.slf4j.Logger logger -
userController
-
mockUsers
-
-
Constructor Details
-
UserControllerTest
UserControllerTest()
-
-
Method Details
-
setup
@BeforeEach public void setup() -
testCreateNewUser
Test whether a new user (with complete and valid data) can be created- Throws:
Exception
-
testCreateNewUserWithMissingData
Test whether the API will reject an attempt to create a user with invalid data- Throws:
Exception
-
testCreateUserWithNonUniqueData
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 whether a user that exists can be successfully deleted- Throws:
Exception
-
testDeleteUserDoesNotExist
Test whether the API will reject an attempt to delete a user that does not exist- Throws:
Exception
-
testUpdateUser
Test whether a user that exists can have their information (e.g. first name or email) updated- Throws:
Exception
-
testUpdateUserDoesNotExist
Test whether the API will reject an attempt to update a user that does not exist- Throws:
Exception
-
testGetUser
Test whether the data of user that exists can be retrieved- Throws:
Exception
-
testGetUserDoesNotExist
Test whether the API will reject an attempt to retrieve the data of a user that does not exist- Throws:
Exception
-
testLoginSuccess
Test whether the API will return a user's data when they have successfully logged in- Throws:
Exception
-
testLoginFailure
Test whether the API will reject an attempt to log in with an incorrect password- Throws:
Exception
-
testLoginWithUserDoesNotExist
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 whether a user's saved recipes can be retrieved- Throws:
Exception
-
testGetSavedRecipesUserDoesNotExist
Test whether the API will reject an attempt to retrieve recipes from an account that does not exist- Throws:
Exception
-
testSaveRecipeToAccount
Test whether a recipe that exists can be saved to a user account that exists- Throws:
Exception
-
testSaveRecipeToAccountUserDoesNotExist
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 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 whether a dietary restriction can be added to an account- Throws:
Exception
-
testAddDietaryRestrictionToAccountUserDoesNotExist
@Test @DirtiesContext public void testAddDietaryRestrictionToAccountUserDoesNotExist() throws ExceptionTest whether the API will reject an attempt to add a dietary restriction to an account that does not exist- Throws:
Exception
-
testAddDietaryRestrictionDoesNotExistToAccount
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 whether a dietary restriction can be removed from an account- Throws:
Exception
-
testRemoveDietaryRestrictionFromAccountUserDoesNotExist
@Test @DirtiesContext public void testRemoveDietaryRestrictionFromAccountUserDoesNotExist() throws ExceptionTest 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 ExceptionTest whether the API will reject an attempt to remove a dietary restriction that does not exist from an account that does exist- Throws:
Exception
-