Skip to content

Instantly share code, notes, and snippets.

@vladdedita
Created November 21, 2024 23:09
Show Gist options
  • Save vladdedita/347f5285845124044f474c86c98d04ea to your computer and use it in GitHub Desktop.
Save vladdedita/347f5285845124044f474c86c98d04ea to your computer and use it in GitHub Desktop.
@ExtendWith(SQLiteExtension.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 CleanSQLiteTest {
@Autowired
EntityManager entityManager;
@Test
void test() {
// Query data
var result = entityManager.createNativeQuery("SELECT COUNT(*) FROM user").getSingleResult();
assertThat(result).isEqualTo(2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment