Skip to content

Instantly share code, notes, and snippets.

@eddumelendez
Created May 17, 2023 14:42
Show Gist options
  • Save eddumelendez/fa59bf6270a292c379eda7da52749b8e to your computer and use it in GitHub Desktop.
Save eddumelendez/fa59bf6270a292c379eda7da52749b8e to your computer and use it in GitHub Desktop.
@Testcontainers
@JdbcTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
class PostgresTest {
@Container
@ServiceConnection
private static final PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:15-alpine");
@Autowired
private JdbcTemplate jdbcTemplate;
@Test
void test() {
var records = this.jdbcTemplate.queryForList("select * from profile");
assertThat(records).hasSize(1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment