Skip to content

Instantly share code, notes, and snippets.

@vladdedita
Created November 21, 2024 23:31
Show Gist options
  • Save vladdedita/37426ed8be76e55c3e54e32e42ec2252 to your computer and use it in GitHub Desktop.
Save vladdedita/37426ed8be76e55c3e54e32e42ec2252 to your computer and use it in GitHub Desktop.
@ExtendWith({
PostgreSQLExtension.class,
ReportingExtension.class
})
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = {
// We need to enable lazy initialization to avoid the EntityManager creation during the context loading
"spring.main.lazy-initialization=true"
})
class CleanTimingTest {
@Autowired
EntityManager entityManager;
@Test
void test() {
// Query data
var result = entityManager.createNativeQuery("SELECT COUNT(*) FROM public.user").getSingleResult();
assertThat(result).isEqualTo(2L);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment