File tree Expand file tree Collapse file tree 6 files changed +11
-31
lines changed
src/test/java/io/appium/java_client Expand file tree Collapse file tree 6 files changed +11
-31
lines changed Original file line number Diff line number Diff line change @@ -48,11 +48,7 @@ public class AndroidContextTest extends BaseAndroidTest {
4848 }
4949
5050 @ Test public void testContextError () {
51- assertThrows (NoSuchContextException .class ,
52- () -> {
53- driver .context ("Planet of the Ape-ium" );
54- assertEquals ("Planet of the Ape-ium" , driver .getContext ());
55- });
51+ assertThrows (NoSuchContextException .class , () -> driver .context ("Planet of the Ape-ium" ));
5652 }
5753
5854}
Original file line number Diff line number Diff line change 66import static org .hamcrest .core .Is .is ;
77import static org .hamcrest .core .StringContains .containsString ;
88import static org .junit .jupiter .api .Assertions .assertThrows ;
9- import static org .junit .jupiter .api .Assertions .assertTrue ;
109
1110import io .appium .java_client .functions .AppiumFunction ;
1211import io .appium .java_client .functions .ExpectedCondition ;
@@ -132,15 +131,14 @@ public void complexWaitingTestWithPreCondition() {
132131 public void nullPointerExceptionSafetyTestWithPrecondition () {
133132 Wait <Pattern > wait = new FluentWait <>(Pattern .compile ("Fake_context" ))
134133 .withTimeout (ofSeconds (30 )).pollingEvery (ofMillis (500 ));
135- assertThrows (TimeoutException .class ,
136- () -> assertTrue (wait .until (searchingFunction .compose (contextFunction )).size () > 0 ));
134+ assertThrows (TimeoutException .class , () -> wait .until (searchingFunction .compose (contextFunction )));
137135 }
138136
139137 @ Test
140138 public void nullPointerExceptionSafetyTestWithPostConditions () {
141139 Wait <Pattern > wait = new FluentWait <>(Pattern .compile ("Fake_context" ))
142140 .withTimeout (ofSeconds (30 )).pollingEvery (ofMillis (500 ));
143141 assertThrows (TimeoutException .class ,
144- () -> assertTrue ( wait .until (contextFunction .andThen (searchingFunction ).andThen (filteringFunction )). size () > 0 ));
142+ () -> wait .until (contextFunction .andThen (searchingFunction ).andThen (filteringFunction )));
145143 }
146144}
Original file line number Diff line number Diff line change @@ -20,14 +20,12 @@ public void verifyGettingExistingValue() {
2020
2121 @ Test
2222 public void verifyGettingNonExistingValue () {
23- assertThrows (IllegalArgumentException .class ,
24- () -> assertThat (Config .main ().getValue (MISSING_KEY , String .class ).length (), greaterThan (0 )));
23+ assertThrows (IllegalArgumentException .class , () -> Config .main ().getValue (MISSING_KEY , String .class ));
2524 }
2625
2726 @ Test
2827 public void verifyGettingExistingValueWithWrongClass () {
29- assertThrows (ClassCastException .class ,
30- () -> assertThat (Config .main ().getValue (EXISTING_KEY , Integer .class ), greaterThan (0 )));
28+ assertThrows (ClassCastException .class , () -> Config .main ().getValue (EXISTING_KEY , Integer .class ));
3129 }
3230
3331 @ Test
Original file line number Diff line number Diff line change @@ -42,10 +42,6 @@ public class IOSContextTest extends BaseIOSWebViewTest {
4242 }
4343
4444 @ Test public void testContextError () {
45- assertThrows (NoSuchContextException .class ,
46- () -> {
47- driver .context ("Planet of the Ape-ium" );
48- assertEquals ("Planet of the Ape-ium" , driver .getContext ());
49- });
45+ assertThrows (NoSuchContextException .class , () -> driver .context ("Planet of the Ape-ium" ));
5046 }
5147}
Original file line number Diff line number Diff line change @@ -326,8 +326,7 @@ public class AndroidPageObjectTest extends BaseAndroidTest {
326326
327327 @ Test public void checkThatTestWillNotBeFailedBecauseOfInvalidFindBy () {
328328 assertThrows (NoSuchElementException .class ,
329- () -> assertNotNull (
330- elementWhenAndroidLocatorIsNotDefinedAndThereIsInvalidFindBy .getAttribute ("text" )));
329+ () -> elementWhenAndroidLocatorIsNotDefinedAndThereIsInvalidFindBy .getAttribute ("text" ));
331330 }
332331
333332 @ Test public void checkThatTestWillNotBeFailedBecauseOfInvalidFindByList () {
@@ -351,8 +350,7 @@ public class AndroidPageObjectTest extends BaseAndroidTest {
351350
352351 @ Test
353352 public void checkThatElementSearchingThrowsExpectedExceptionIfChainedLocatorIsInvalid () {
354- assertThrows (NoSuchElementException .class ,
355- () -> assertNotNull (elementFoundByInvalidChainedSelector .getAttribute ("text" )));
353+ assertThrows (NoSuchElementException .class , () -> elementFoundByInvalidChainedSelector .getAttribute ("text" ));
356354 }
357355
358356 @ Test public void checkThatListSearchingWorksIfChainedLocatorIsInvalid () {
Original file line number Diff line number Diff line change @@ -339,22 +339,16 @@ public void checkAbilityToStartServiceUsingValidBasePathWithSinglePathParams() {
339339
340340 @ Test
341341 public void checkAbilityToValidateBasePathForEmptyBasePath () {
342- assertThrows (IllegalArgumentException .class , () -> {
343- new AppiumServiceBuilder ().withArgument (BASEPATH , "" ).build ();
344- });
342+ assertThrows (IllegalArgumentException .class , () -> new AppiumServiceBuilder ().withArgument (BASEPATH , "" ));
345343 }
346344
347345 @ Test
348346 public void checkAbilityToValidateBasePathForBlankBasePath () {
349- assertThrows (IllegalArgumentException .class , () -> {
350- new AppiumServiceBuilder ().withArgument (BASEPATH , " " ).build ();
351- });
347+ assertThrows (IllegalArgumentException .class , () -> new AppiumServiceBuilder ().withArgument (BASEPATH , " " ));
352348 }
353349
354350 @ Test
355351 public void checkAbilityToValidateBasePathForNullBasePath () {
356- assertThrows (NullPointerException .class , () -> {
357- new AppiumServiceBuilder ().withArgument (BASEPATH , null ).build ();
358- });
352+ assertThrows (NullPointerException .class , () -> new AppiumServiceBuilder ().withArgument (BASEPATH , null ));
359353 }
360354}
You can’t perform that action at this time.
0 commit comments