Skip to content

Commit

Permalink
[java] Let JUnit do its job
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Oct 23, 2018
1 parent 92f4ed8 commit fb249b3
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions java/client/test/org/openqa/selenium/AlertsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,9 @@ public void testShouldThrowIllegalArgumentExceptionWhenKeysNull() {

driver.findElement(By.id("alert")).click();
Alert alert = wait.until(alertIsPresent());
try {
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> alert.sendKeys(null));
} finally {
alert.accept();
}

assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> alert.sendKeys(null));
}

@Test
Expand All @@ -138,11 +135,8 @@ public void testShouldGetTextOfAlertOpenedInSetTimeout() {

driver.findElement(By.id("slow-alert")).click();
Alert alert = wait.until(alertIsPresent());
try {
assertThat(alert.getText()).isEqualTo("Slow");
} finally {
alert.accept();
}

assertThat(alert.getText()).isEqualTo("Slow");
}

@Test
Expand Down Expand Up @@ -201,12 +195,8 @@ public void testSettingTheValueOfAnAlertThrows() {
driver.findElement(By.id("alert")).click();

Alert alert = wait.until(alertIsPresent());
try {
assertThatExceptionOfType(ElementNotInteractableException.class)
.isThrownBy(() -> alert.sendKeys("cheese"));
} finally {
alert.accept();
}
assertThatExceptionOfType(ElementNotInteractableException.class)
.isThrownBy(() -> alert.sendKeys("cheese"));
}

@Test
Expand Down

0 comments on commit fb249b3

Please sign in to comment.