@@ -461,7 +461,7 @@ public void testShardRoutingWithNetworkDisruption_FailOpenDisabled() throws Exce
461461 hitNodes .add (searchResponse .getHits ().getAt (j ).getShard ().getNodeId ());
462462 }
463463 } catch (Exception t ) {
464- fail ("search should not fail" );
464+ throw new AssertionError ("search should not fail" , t );
465465 }
466466 }
467467 Assert .assertTrue (failedShardCount > 0 );
@@ -537,7 +537,7 @@ public void testShardRoutingWithNetworkDisruption_FailOpenEnabled() throws Excep
537537 hitNodes .add (searchResponse .getHits ().getAt (j ).getShard ().getNodeId ());
538538 }
539539 } catch (Exception t ) {
540- fail ("search should not fail" );
540+ throw new AssertionError ("search should not fail" , t );
541541 }
542542 }
543543
@@ -604,7 +604,7 @@ public void testStrictWeightedRoutingWithCustomString_FailOpenEnabled() throws E
604604 hitNodes .add (searchResponse .getHits ().getAt (j ).getShard ().getNodeId ());
605605 }
606606 } catch (Exception t ) {
607- fail ("search should not fail" );
607+ throw new AssertionError ("search should not fail" , t );
608608 }
609609 }
610610
@@ -674,7 +674,7 @@ public void testStrictWeightedRoutingWithCustomString_FailOpenDisabled() throws
674674 hitNodes .add (searchResponse .getHits ().getAt (j ).getShard ().getNodeId ());
675675 }
676676 } catch (Exception t ) {
677- fail ("search should not fail" );
677+ throw new AssertionError ("search should not fail" , t );
678678 }
679679 }
680680
@@ -762,7 +762,7 @@ public void testStrictWeightedRoutingWithShardPrefNetworkDisruption_FailOpenEnab
762762 SearchResponse searchResponse = responses [i ].get ();
763763 assertEquals (searchResponse .getFailedShards (), 0 );
764764 } catch (Exception t ) {
765- fail ("search should not fail" );
765+ throw new AssertionError ("search should not fail" , t );
766766 }
767767 }
768768
@@ -825,7 +825,7 @@ public void testStrictWeightedRoutingWithShardPref() throws Exception {
825825 assertEquals (searchResponse .getFailedShards (), 0 );
826826 assertNotEquals (searchResponse .getHits ().getTotalHits ().value (), 0 );
827827 } catch (Exception t ) {
828- fail ("search should not fail" );
828+ throw new AssertionError ("search should not fail" , t );
829829 }
830830 }
831831 assertNoSearchInAZ ("c" );
@@ -959,7 +959,7 @@ public void testSearchAggregationWithNetworkDisruption_FailOpenEnabled() throws
959959 hitNodes .add (searchResponse .getHits ().getAt (j ).getShard ().getNodeId ());
960960 }
961961 } catch (Exception t ) {
962- fail ("search should not fail" );
962+ throw new AssertionError ("search should not fail" , t );
963963 }
964964 }
965965 networkDisruption .stopDisrupting ();
@@ -1036,7 +1036,7 @@ public void testMultiGetWithNetworkDisruption_FailOpenEnabled() throws Exception
10361036 assertThat (multiGetResponse .getResponses ()[0 ].isFailed (), equalTo (false ));
10371037 assertThat (multiGetResponse .getResponses ()[1 ].isFailed (), equalTo (false ));
10381038 } catch (Exception t ) {
1039- fail ("search should not fail" );
1039+ throw new AssertionError ("search should not fail" , t );
10401040 }
10411041 }
10421042
@@ -1108,7 +1108,7 @@ public void testMultiGetWithNetworkDisruption_FailOpenDisabled() throws Exceptio
11081108 failedCount ++;
11091109 }
11101110 } catch (Exception t ) {
1111- fail ("search should not fail" );
1111+ throw new AssertionError ("search should not fail" , t );
11121112 }
11131113 }
11141114
@@ -1451,7 +1451,7 @@ public void testWeightedRoutingFailOpenStats() throws Exception {
14511451 hitNodes .add (searchResponse .getHits ().getAt (j ).getShard ().getNodeId ());
14521452 }
14531453 } catch (Exception t ) {
1454- fail ("search should not fail" );
1454+ throw new AssertionError ("search should not fail" , t );
14551455 }
14561456 assertSearchInAZ ("b" );
14571457 assertSearchInAZ ("c" );
0 commit comments