33import com .datastax .oss .driver .api .core .CqlSession ;
44import com .datastax .oss .driver .api .core .cql .ResultSet ;
55import com .datastax .oss .driver .api .core .cql .Row ;
6- import org .junit .Test ;
6+ import org .junit .jupiter . api . Test ;
77import org .testcontainers .containers .ContainerLaunchException ;
88import org .testcontainers .utility .DockerImageName ;
99
1010import static org .assertj .core .api .Assertions .assertThat ;
11- import static org .assertj .core .api .Assertions .catchThrowable ;
11+ import static org .assertj .core .api .Assertions .assertThatThrownBy ;
1212
13- public class CassandraContainerTest {
13+ class CassandraContainerTest {
1414
1515 private static final String CASSANDRA_IMAGE = "cassandra:3.11.2" ;
1616
@@ -19,7 +19,7 @@ public class CassandraContainerTest {
1919 private static final String BASIC_QUERY = "SELECT release_version FROM system.local" ;
2020
2121 @ Test
22- public void testSimple () {
22+ void testSimple () {
2323 try ( // container-definition {
2424 CassandraContainer cassandraContainer = new CassandraContainer ("cassandra:3.11.2" )
2525 // }
@@ -32,7 +32,7 @@ public void testSimple() {
3232 }
3333
3434 @ Test
35- public void testSpecificVersion () {
35+ void testSpecificVersion () {
3636 String cassandraVersion = "3.0.15" ;
3737 try (
3838 CassandraContainer cassandraContainer = new CassandraContainer (
@@ -47,7 +47,7 @@ public void testSpecificVersion() {
4747 }
4848
4949 @ Test
50- public void testConfigurationOverride () {
50+ void testConfigurationOverride () {
5151 try (
5252 CassandraContainer cassandraContainer = new CassandraContainer (CASSANDRA_IMAGE )
5353 .withConfigurationOverride ("cassandra-test-configuration-example" )
@@ -61,18 +61,18 @@ public void testConfigurationOverride() {
6161 }
6262 }
6363
64- @ Test ( expected = ContainerLaunchException . class )
65- public void testEmptyConfigurationOverride () {
64+ @ Test
65+ void testEmptyConfigurationOverride () {
6666 try (
6767 CassandraContainer cassandraContainer = new CassandraContainer (CASSANDRA_IMAGE )
6868 .withConfigurationOverride ("cassandra-empty-configuration" )
6969 ) {
70- cassandraContainer . start ( );
70+ assertThatThrownBy ( cassandraContainer :: start ). isInstanceOf ( ContainerLaunchException . class );
7171 }
7272 }
7373
7474 @ Test
75- public void testInitScript () {
75+ void testInitScript () {
7676 try (
7777 CassandraContainer cassandraContainer = new CassandraContainer (CASSANDRA_IMAGE )
7878 .withInitScript ("initial.cql" )
@@ -83,17 +83,17 @@ public void testInitScript() {
8383 }
8484
8585 @ Test
86- public void testNonexistentInitScript () {
86+ void testNonexistentInitScript () {
8787 try (
8888 CassandraContainer cassandraContainer = new CassandraContainer (CASSANDRA_IMAGE )
8989 .withInitScript ("unknown_script.cql" )
9090 ) {
91- assertThat ( catchThrowable ( cassandraContainer ::start ) ).isInstanceOf (ContainerLaunchException .class );
91+ assertThatThrownBy ( cassandraContainer ::start ).isInstanceOf (ContainerLaunchException .class );
9292 }
9393 }
9494
9595 @ Test
96- public void testInitScriptWithRequiredAuthentication () {
96+ void testInitScriptWithRequiredAuthentication () {
9797 try (
9898 // init-with-auth {
9999 CassandraContainer cassandraContainer = new CassandraContainer (CASSANDRA_IMAGE )
@@ -106,18 +106,18 @@ public void testInitScriptWithRequiredAuthentication() {
106106 }
107107 }
108108
109- @ Test ( expected = ContainerLaunchException . class )
110- public void testInitScriptWithError () {
109+ @ Test
110+ void testInitScriptWithError () {
111111 try (
112112 CassandraContainer cassandraContainer = new CassandraContainer (CASSANDRA_IMAGE )
113113 .withInitScript ("initial-with-error.cql" )
114114 ) {
115- cassandraContainer . start ( );
115+ assertThatThrownBy ( cassandraContainer :: start ). isInstanceOf ( ContainerLaunchException . class );
116116 }
117117 }
118118
119119 @ Test
120- public void testInitScriptWithLegacyCassandra () {
120+ void testInitScriptWithLegacyCassandra () {
121121 try (
122122 CassandraContainer cassandraContainer = new CassandraContainer ("cassandra:2.2.11" )
123123 .withInitScript ("initial.cql" )
0 commit comments