You have the following class for repository testing. The database is empty before the test execution.
@DataJpaTest
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class ApplicationTests {
@Autowired
private UserRepository userRepository;
@Rollback(false)
@Order(1)
@Test
//first method
void testAddindDataToTable() {
userRepository.save(new User(1, "John"));
userRepository.save(new User(2, "Jack"));
List<Product> userList = userRepository.findAll();
assertEquals(2, userList.size());
}
@Order(2)
@Test
//second method
void testDefiningSizeOfTable() {
userRepository.save(new User(3, "Liza"));
userRepository.save(new User(4, "Ellie"));
userRepository.save(new User(5, "Max"));
List<Product> userList = userRepository.findAll();
assertEquals(3, userList.size());
}
}
What will be the results of the tests execution?