Unit Test (Spring boot)

Spring boot test

  • Create a fully-configured instance of the Spring ApplicationContext for testing.

  • Can be used to test the application’s components

  • Auto inject the mock and spy bean into class

Data Jpa Test

  • Configures our entities, repositories and also sets up an embedded database

Mock

  • The method of the mock class will not be implemented

  • For simulating the edge cases and make sure that the interaction happened

Spy

  • Partially mocking the class

  • Part of the function can be implementation, e.g: The add children of array

Last updated

Was this helpful?