For unit testing, we are using a JUnit, which is a popular Java-based unit testing library. The following source code shows the example skeleton of the Spring Boot test class. The @SpringBootTest annotation specifies that the class is a regular test class that runs Spring Boot-based tests. The @Test annotation before the method specifies to JUnit that the method can be run as a test case. The @RunWith(SpringRunner.class) annotation provides Spring's ApplicationContext and gets beans injected into your test instance:
@RunWith(SpringRunner.class)
@SpringBootTest
public class MyTestsClass {
@Test
public void testMethod() {
...
}
}
First, we will create our first test case, which will test the major functionality of our application before we create any formal test cases. Open the CardatabaseApplicationTest test class that has already been made for your...