File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
src/test/java/io/selenium/util Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 1616import java .util .List ;
1717
1818import static org .junit .jupiter .api .Assertions .assertEquals ;
19- import static org .junit .jupiter .api .Assertions .fail ;
19+ import static org .junit .jupiter .api .Assertions .assertThrows ;
2020
2121
2222public class CachedLookupTest {
@@ -54,16 +54,10 @@ public void checkCachedGroceryListItems() {
5454 firstItem .getRemoveButton ().click ();
5555 lastItem .getRemoveButton ().click ();
5656 assertEquals ("Baking item2" , item2 .getName ().getText ());
57- try {
58- firstItem .getName ().getText ();
59- fail ("Should throw stale element reference exception" );
60- } catch (StaleElementReferenceException ignored ) {
61- }
62- try {
63- lastItem .getName ().getText ();
64- fail ("Should throw stale element reference exception" );
65- } catch (StaleElementReferenceException ignored ) {
66- }
57+ assertThrows (StaleElementReferenceException .class , () ->
58+ firstItem .getName ().getText (), "Should throw stale element reference exception" );
59+ assertThrows (StaleElementReferenceException .class , () ->
60+ lastItem .getName ().getText (), "Should throw stale element reference exception" );
6761 }
6862
6963 @ Test
You can’t perform that action at this time.
0 commit comments