Best Testcontainers-java code snippet using org.testcontainers.junit.cockroachdb.SimpleCockroachDBTest
Source:SimpleCockroachDBTest.java
...9import static org.hamcrest.CoreMatchers.containsString;10import static org.junit.Assert.assertThat;11import static org.rnorth.visibleassertions.VisibleAssertions.assertEquals;12import static org.testcontainers.CockroachDBTestImages.COCKROACHDB_IMAGE;13public class SimpleCockroachDBTest extends AbstractContainerDatabaseTest {14 static {15 // Postgres JDBC driver uses JUL; disable it to avoid annoying, irrelevant, stderr logs during connection testing16 LogManager.getLogManager().getLogger("").setLevel(Level.OFF);17 }18 @Test19 public void testSimple() throws SQLException {20 try (CockroachContainer cockroach = new CockroachContainer(COCKROACHDB_IMAGE)) {21 cockroach.start();22 ResultSet resultSet = performQuery(cockroach, "SELECT 1");23 int resultSetInt = resultSet.getInt(1);24 assertEquals("A basic SELECT query succeeds", 1, resultSetInt);25 }26 }27 @Test...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!