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 @@ -55,9 +55,6 @@ public class ElasticsearchWriterTest extends ElasticsearchSinkTestBase {
5555 private final Schema otherSchema = createOtherSchema ();
5656 private final Struct otherRecord = createOtherRecord (otherSchema );
5757
58- @ Rule
59- public ExpectedException thrown = ExpectedException .none ();
60-
6158 private boolean ignoreKey ;
6259 private boolean ignoreSchema ;
6360
@@ -428,9 +425,10 @@ public void testInvalidRecordException() throws Exception {
428425
429426 final ElasticsearchWriter strictWriter = initWriter (client );
430427
431- thrown .expect (ConnectException .class );
432- thrown .expectMessage ("Key is used as document id and can not be null" );
433- strictWriter .write (records );
428+ Exception e = assertThrows (ConnectException .class , () -> {
429+ strictWriter .write (records );
430+ });
431+ assertEquals ("Key is used as document id and can not be null." , e .getMessage ());
434432 }
435433
436434 @ Test
You can’t perform that action at this time.
0 commit comments