diff --git a/server/src/test/java/org/elasticsearch/bwcompat/RecoveryWithUnsupportedIndicesIT.java b/server/src/test/java/org/elasticsearch/bwcompat/RecoveryWithUnsupportedIndicesIT.java index 73076e7941583..53efeb393e4b4 100644 --- a/server/src/test/java/org/elasticsearch/bwcompat/RecoveryWithUnsupportedIndicesIT.java +++ b/server/src/test/java/org/elasticsearch/bwcompat/RecoveryWithUnsupportedIndicesIT.java @@ -86,11 +86,7 @@ public void testUpgradeStartClusterOn_2_4_5() throws Exception { logger.info("Checking static index {}", indexName); Settings nodeSettings = prepareBackwardsDataDir(getBwcIndicesPath().resolve(indexName + ".zip")); - try { - internalCluster().startNode(nodeSettings); - fail(); - } catch (Exception ex) { - assertThat(ex.getCause().getCause().getMessage(), containsString("Format version is not supported")); - } + assertThat(expectThrows(Exception.class, () -> internalCluster().startNode(nodeSettings)) + .getCause().getCause().getMessage(), containsString("Format version is not supported")); } }