Package com.cis.gorecipe
Class BaseTest
java.lang.Object
com.cis.gorecipe.BaseTest
- Direct Known Subclasses:
FoodImageControllerTest,RecipeControllerTest,UserControllerTest
@SpringBootTest(classes=Application.class,
webEnvironment=RANDOM_PORT)
@ActiveProfiles("test")
@AutoConfigureMockMvc(addFilters=false)
@TestPropertySource(locations="classpath:test.properties")
public abstract class BaseTest
extends Object
This class establishes the testcontainer environment and all objects needed for any testing
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ClarifaiServiceprotected ClassLoaderprotected org.springframework.security.crypto.bcrypt.BCryptPasswordEncoderprotected FoodImageRepositoryprotected IngredientRepositoryprotected org.springframework.test.web.servlet.MockMvcprivate static org.testcontainers.containers.MySQLContainer<?>An isolated MySQL database inside a docker container to use for testingprotected RecipeRepositoryprotected S3Serviceprotected com.fasterxml.jackson.databind.ObjectMapperA JSON serializer to deserialize API responsesprotected SpoonacularServiceprotected UserRepositoryprotected org.springframework.web.context.WebApplicationContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidsetDatasourceProperties(org.springframework.test.context.DynamicPropertyRegistry registry)void
-
Field Details
-
mySQLContainer
private static final org.testcontainers.containers.MySQLContainer<?> mySQLContainerAn isolated MySQL database inside a docker container to use for testing -
serializer
protected final com.fasterxml.jackson.databind.ObjectMapper serializerA JSON serializer to deserialize API responses -
classLoader
-
encoder
protected final org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder encoder -
s3Service
-
clarifaiService
-
spoonacularService
-
userRepository
-
ingredientRepository
-
foodImageRepository
-
recipeRepository
-
wac
@Autowired protected org.springframework.web.context.WebApplicationContext wac -
mockMvc
@Autowired protected org.springframework.test.web.servlet.MockMvc mockMvc
-
-
Constructor Details
-
BaseTest
public BaseTest()
-
-
Method Details
-
setDatasourceProperties
@DynamicPropertySource public static void setDatasourceProperties(org.springframework.test.context.DynamicPropertyRegistry registry) -
setupMockMvc
public void setupMockMvc()
-