@ExtendWith(SpringExtension.class)
@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
@ContextConfiguration(classes = {MyApplication.class})
@ImportAutoConfiguration(RefreshAutoConfiguration.class)
@ActiveProfiles(value = "local")
class EmployeeRepositoryTest
{
@Autowired
private EmployeeRepository employeeRepository;
@Test
void getAllEmployees()
{
List<Employee> employeesList=employeeRepository.findAll();
employeesList.forEach(employee -> System.out.println(employee.getName()));
assertNotNull(employeesList);
}
}
Created
December 22, 2021 22:43
-
-
Save pavankjadda/de0419052a6e57403ca3aea3432692c2 to your computer and use it in GitHub Desktop.
Spring Boot Repository layer unit Test.md
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment