Skip to content

Commit 9e9647b

Browse files
committed
MINOR: Fix tests
1 parent da45461 commit 9e9647b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/test/java/io/confluent/connect/elasticsearch/ElasticsearchWriterTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)