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 Details

    • mySQLContainer

      private static final org.testcontainers.containers.MySQLContainer<?> mySQLContainer
      An isolated MySQL database inside a docker container to use for testing
    • serializer

      protected final com.fasterxml.jackson.databind.ObjectMapper serializer
      A JSON serializer to deserialize API responses
    • classLoader

      protected final ClassLoader classLoader
    • encoder

      protected final org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder encoder
    • s3Service

      @MockBean protected S3Service s3Service
    • clarifaiService

      @MockBean protected ClarifaiService clarifaiService
    • spoonacularService

      @MockBean protected SpoonacularService spoonacularService
    • userRepository

      @Autowired protected UserRepository userRepository
    • ingredientRepository

      @Autowired protected IngredientRepository ingredientRepository
    • foodImageRepository

      @Autowired protected FoodImageRepository foodImageRepository
    • recipeRepository

      @Autowired protected RecipeRepository 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()