Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ public class AndroidContextTest extends BaseAndroidTest {
}

@Test public void testContextError() {
assertThrows(NoSuchContextException.class,
() -> {
driver.context("Planet of the Ape-ium");
assertEquals("Planet of the Ape-ium", driver.getContext());
});
assertThrows(NoSuchContextException.class, () -> driver.context("Planet of the Ape-ium"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.StringContains.containsString;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import io.appium.java_client.functions.AppiumFunction;
import io.appium.java_client.functions.ExpectedCondition;
Expand Down Expand Up @@ -132,15 +131,14 @@ public void complexWaitingTestWithPreCondition() {
public void nullPointerExceptionSafetyTestWithPrecondition() {
Wait<Pattern> wait = new FluentWait<>(Pattern.compile("Fake_context"))
.withTimeout(ofSeconds(30)).pollingEvery(ofMillis(500));
assertThrows(TimeoutException.class,
() -> assertTrue(wait.until(searchingFunction.compose(contextFunction)).size() > 0));
assertThrows(TimeoutException.class, () -> wait.until(searchingFunction.compose(contextFunction)));
}

@Test
public void nullPointerExceptionSafetyTestWithPostConditions() {
Wait<Pattern> wait = new FluentWait<>(Pattern.compile("Fake_context"))
.withTimeout(ofSeconds(30)).pollingEvery(ofMillis(500));
assertThrows(TimeoutException.class,
() -> assertTrue(wait.until(contextFunction.andThen(searchingFunction).andThen(filteringFunction)).size() > 0));
() -> wait.until(contextFunction.andThen(searchingFunction).andThen(filteringFunction)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ public void verifyGettingExistingValue() {

@Test
public void verifyGettingNonExistingValue() {
assertThrows(IllegalArgumentException.class,
() -> assertThat(Config.main().getValue(MISSING_KEY, String.class).length(), greaterThan(0)));
assertThrows(IllegalArgumentException.class, () -> Config.main().getValue(MISSING_KEY, String.class));
}

@Test
public void verifyGettingExistingValueWithWrongClass() {
assertThrows(ClassCastException.class,
() -> assertThat(Config.main().getValue(EXISTING_KEY, Integer.class), greaterThan(0)));
assertThrows(ClassCastException.class, () -> Config.main().getValue(EXISTING_KEY, Integer.class));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ public class IOSContextTest extends BaseIOSWebViewTest {
}

@Test public void testContextError() {
assertThrows(NoSuchContextException.class,
() -> {
driver.context("Planet of the Ape-ium");
assertEquals("Planet of the Ape-ium", driver.getContext());
});
assertThrows(NoSuchContextException.class, () -> driver.context("Planet of the Ape-ium"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,7 @@ public class AndroidPageObjectTest extends BaseAndroidTest {

@Test public void checkThatTestWillNotBeFailedBecauseOfInvalidFindBy() {
assertThrows(NoSuchElementException.class,
() -> assertNotNull(
elementWhenAndroidLocatorIsNotDefinedAndThereIsInvalidFindBy.getAttribute("text")));
() -> elementWhenAndroidLocatorIsNotDefinedAndThereIsInvalidFindBy.getAttribute("text"));
}

@Test public void checkThatTestWillNotBeFailedBecauseOfInvalidFindByList() {
Expand All @@ -351,8 +350,7 @@ public class AndroidPageObjectTest extends BaseAndroidTest {

@Test
public void checkThatElementSearchingThrowsExpectedExceptionIfChainedLocatorIsInvalid() {
assertThrows(NoSuchElementException.class,
() -> assertNotNull(elementFoundByInvalidChainedSelector.getAttribute("text")));
assertThrows(NoSuchElementException.class, () -> elementFoundByInvalidChainedSelector.getAttribute("text"));
}

@Test public void checkThatListSearchingWorksIfChainedLocatorIsInvalid() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,22 +339,16 @@ public void checkAbilityToStartServiceUsingValidBasePathWithSinglePathParams() {

@Test
public void checkAbilityToValidateBasePathForEmptyBasePath() {
assertThrows(IllegalArgumentException.class, () -> {
new AppiumServiceBuilder().withArgument(BASEPATH, "").build();
});
assertThrows(IllegalArgumentException.class, () -> new AppiumServiceBuilder().withArgument(BASEPATH, ""));
}

@Test
public void checkAbilityToValidateBasePathForBlankBasePath() {
assertThrows(IllegalArgumentException.class, () -> {
new AppiumServiceBuilder().withArgument(BASEPATH, " ").build();
});
assertThrows(IllegalArgumentException.class, () -> new AppiumServiceBuilder().withArgument(BASEPATH, " "));
}

@Test
public void checkAbilityToValidateBasePathForNullBasePath() {
assertThrows(NullPointerException.class, () -> {
new AppiumServiceBuilder().withArgument(BASEPATH, null).build();
});
assertThrows(NullPointerException.class, () -> new AppiumServiceBuilder().withArgument(BASEPATH, null));
}
}