File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
src/test/java/io/confluent/connect/elasticsearch Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -54,9 +54,6 @@ public class ElasticsearchWriterTest extends ElasticsearchSinkTestBase {
5454 private final Schema otherSchema = createOtherSchema ();
5555 private final Struct otherRecord = createOtherRecord (otherSchema );
5656
57- @ Rule
58- public ExpectedException thrown = ExpectedException .none ();
59-
6057 private boolean ignoreKey ;
6158 private boolean ignoreSchema ;
6259
@@ -427,9 +424,10 @@ public void testInvalidRecordException() throws Exception {
427424
428425 final ElasticsearchWriter strictWriter = initWriter (client );
429426
430- thrown .expect (ConnectException .class );
431- thrown .expectMessage ("Key is used as document id and can not be null" );
432- strictWriter .write (records );
427+ Exception e = assertThrows (ConnectException .class , () -> {
428+ strictWriter .write (records );
429+ });
430+ assertEquals ("Key is used as document id and can not be null." , e .getMessage ());
433431 }
434432
435433 @ Test
You can’t perform that action at this time.
0 commit comments