@@ -62,8 +62,7 @@ void buildWriteOptions() {
6262 assertThat (writeOptions .getTracing ()).isTrue ();
6363 assertThat (writeOptions .getKeyspace ()).isEqualTo (CqlIdentifier .fromCql ("my_keyspace" ));
6464 assertThat (writeOptions .isIdempotent ()).isEqualTo (true );
65- assertThat (writeOptions .getRoutingKeyspace ()).isEqualTo (
66- CqlIdentifier .fromCql ("routing_keyspace" ));
65+ assertThat (writeOptions .getRoutingKeyspace ()).isEqualTo (CqlIdentifier .fromCql ("routing_keyspace" ));
6766 assertThat (writeOptions .getRoutingKey ()).isEqualTo (ByteBuffer .allocate (1 ));
6867 }
6968
@@ -104,36 +103,20 @@ void buildWriteOptionsMutate() {
104103 assertThat (mutated .getPageSize ()).isEqualTo (10 );
105104 assertThat (mutated .getTracing ()).isTrue ();
106105 assertThat (writeOptions .isIdempotent ()).isEqualTo (true );
107- assertThat (writeOptions .getRoutingKeyspace ()).isEqualTo (
108- CqlIdentifier .fromCql ("routing_keyspace" ));
106+ assertThat (writeOptions .getRoutingKeyspace ()).isEqualTo (CqlIdentifier .fromCql ("routing_keyspace" ));
109107 assertThat (writeOptions .getRoutingKey ()).isEqualTo (ByteBuffer .allocate (1 ));
110108 }
111109
112110 @ Test // GH-1248
113111 void buildWriteOptionsWithTtlDurationZero () {
114- try {
115- WriteOptions writeOptions = WriteOptions .builder ()
116- .ttl (Duration .ZERO )
117- .build ();
118-
119- fail ("WiteOptionsBuilder must not allow zero TTL" );
120- }
121- catch (Exception e ) {
122- // expected behavior
123- }
112+ assertThatIllegalArgumentException ().isThrownBy (() -> WriteOptions .builder ().ttl (0 ));
113+ assertThatIllegalArgumentException ().isThrownBy (() -> WriteOptions .builder ().ttl (Duration .ZERO ));
124114 }
125115
126116 @ Test // GH-1248
127117 void buildWriteOptionsWithTtlNegativeDuration () {
128- try {
129- WriteOptions writeOptions = WriteOptions .builder ()
130- .ttl (Duration .of (-1 , ChronoUnit .MICROS ))
131- .build ();
132-
133- fail ("WiteOptionsBuilder must not allow negative TTL" );
134- }
135- catch (Exception e ) {
136- // expected behavior
137- }
118+ assertThatIllegalArgumentException ().isThrownBy (() -> WriteOptions .builder ().ttl (-1 ));
119+ assertThatIllegalArgumentException ()
120+ .isThrownBy (() -> WriteOptions .builder ().ttl (Duration .of (-1 , ChronoUnit .MICROS )));
138121 }
139122}
0 commit comments