Skip to content

Commit 649f2f2

Browse files
committed
expectThrows
1 parent 88eac6f commit 649f2f2

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

server/src/test/java/org/elasticsearch/bwcompat/RecoveryWithUnsupportedIndicesIT.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,7 @@ public void testUpgradeStartClusterOn_2_4_5() throws Exception {
8686

8787
logger.info("Checking static index {}", indexName);
8888
Settings nodeSettings = prepareBackwardsDataDir(getBwcIndicesPath().resolve(indexName + ".zip"));
89-
try {
90-
internalCluster().startNode(nodeSettings);
91-
fail();
92-
} catch (Exception ex) {
93-
assertThat(ex.getCause().getCause().getMessage(), containsString("Format version is not supported"));
94-
}
89+
assertThat(expectThrows(Exception.class, () -> internalCluster().startNode(nodeSettings))
90+
.getCause().getCause().getMessage(), containsString("Format version is not supported"));
9591
}
9692
}

0 commit comments

Comments
 (0)