@@ -725,43 +725,40 @@ public void testWalModeChangeRequiresAllGroupCaches() throws Exception {
725725 assertForAllNodes (CACHE_NAME , true );
726726 assertForAllNodes (CACHE_NAME_2 , true );
727727
728- try {
729- srv .cluster ().disableWal (CACHE_NAME );
730- fail ("Should have thrown exception when trying to disable WAL for only one cache from a group" );
731- }
732- catch (IgniteException e ) {
733- String expectedMsg = "Cannot change WAL mode because not all cache names belonging to the group are provided" ;
734- assertTrue ("Expected message about missing caches, but got: " + e .getMessage (),
735- e .getMessage ().contains (expectedMsg ));
736- }
728+ assertThrows (
729+ () -> {
730+ srv .cluster ().disableWal (CACHE_NAME );
731+ return null ;
732+ },
733+ IgniteException .class ,
734+ "Cannot change WAL mode because not all cache names belonging to the group are provided"
735+ );
737736
738737 assertForAllNodes (CACHE_NAME , true );
739738 assertForAllNodes (CACHE_NAME_2 , true );
740739
741- try {
742- srv .cluster ().enableWal (CACHE_NAME );
743- fail ("Should have thrown exception when trying to change WAL mode for only one cache from a group" );
744- }
745- catch (IgniteException e ) {
746- String expectedMsg = "Cannot change WAL mode because not all cache names belonging to the group are provided" ;
747- assertTrue ("Expected message about missing caches, but got: " + e .getMessage (),
748- e .getMessage ().contains (expectedMsg ));
749- }
740+ assertThrows (
741+ () -> {
742+ srv .cluster ().enableWal (CACHE_NAME );
743+ return null ;
744+ },
745+ IgniteException .class ,
746+ "Cannot change WAL mode because not all cache names belonging to the group are provided"
747+ );
750748
751749 srv .cluster ().disableWal (Arrays .asList (CACHE_NAME , CACHE_NAME_2 ));
752750
753751 assertForAllNodes (CACHE_NAME , false );
754752 assertForAllNodes (CACHE_NAME_2 , false );
755753
756- try {
757- srv .cluster ().enableWal (CACHE_NAME );
758- fail ("Should have thrown exception when trying to enable WAL for only one cache from a group" );
759- }
760- catch (IgniteException e ) {
761- String expectedMsg = "Cannot change WAL mode because not all cache names belonging to the group are provided" ;
762- assertTrue ("Expected message about missing caches, but got: " + e .getMessage (),
763- e .getMessage ().contains (expectedMsg ));
764- }
754+ assertThrows (
755+ () -> {
756+ srv .cluster ().enableWal (CACHE_NAME );
757+ return null ;
758+ },
759+ IgniteException .class ,
760+ "Cannot change WAL mode because not all cache names belonging to the group are provided"
761+ );
765762
766763 srv .cluster ().enableWal (Arrays .asList (CACHE_NAME , CACHE_NAME_2 ));
767764
0 commit comments