Skip to content

Commit

Permalink
Unifying use of hamcrest matcher methods
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev authored and detro committed Mar 19, 2013
1 parent ac94098 commit 62eec51
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 27 deletions.
6 changes: 3 additions & 3 deletions java/client/test/org/openqa/selenium/ArchitectureTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

import org.junit.Test;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.matchers.JUnitMatchers.containsString;

public class ArchitectureTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.core.IsNull.nullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

package org.openqa.selenium;

import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.core.CombinableMatcher;
import org.junit.Test;
import org.openqa.selenium.internal.Locatable;
import org.openqa.selenium.testing.Ignore;
Expand All @@ -30,7 +27,8 @@
import java.util.concurrent.TimeUnit;

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.either;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
Expand Down Expand Up @@ -143,7 +141,7 @@ public void testShouldBeAbleToSubmitFormsByCausingTheOnClickEventToFire() {

waitForTitleChange("We Arrive Here");

assertThat(driver.getTitle(), Matchers.is("We Arrive Here"));
assertThat(driver.getTitle(), is("We Arrive Here"));
}

private void waitForTitleChange(String newTitle) {
Expand All @@ -160,7 +158,7 @@ public void testShouldBeAbleToClickOnSubmitButtons() {

waitForTitleChange("We Arrive Here");

assertThat(driver.getTitle(), Matchers.is("We Arrive Here"));
assertThat(driver.getTitle(), is("We Arrive Here"));
}

@JavascriptEnabled
Expand Down Expand Up @@ -227,10 +225,6 @@ public void testChangeEventIsFiredAppropriatelyWhenFocusIsLost() {
.or(is("focus change blur focus change blur"))); // What Chrome does
}

private static CombinableMatcher.CombinableEitherMatcher<String> either(Matcher<String> matcher) {
return Matchers.either(matcher);
}

/**
* If the click handler throws an exception, the firefox driver freezes. This is suboptimal.
*/
Expand Down
2 changes: 1 addition & 1 deletion java/client/test/org/openqa/selenium/VisibilityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.concurrent.Callable;

import static org.hamcrest.Matchers.not;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@

package org.openqa.selenium.support;

import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.hamcrest.core.IsNull.nullValue;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
Expand All @@ -41,7 +40,7 @@ public class PageFactoryTest extends MockTestBase {
public void shouldProxyElementsInAnInstantiatedPage() {
PublicPage page = new PublicPage();

Assert.assertThat(page.q, is(nullValue()));
assertThat(page.q, is(nullValue()));
assertThat(page.list, is(nullValue()));

PageFactory.initElements(driver, page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package org.openqa.selenium.support.pagefactory;

import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package org.openqa.selenium.support.pagefactory;

import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.hamcrest.core.IsNull.nullValue;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;

import org.openqa.selenium.By;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.core.IsNot.not;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;

@RunWith(SeleniumTestRunner.class)
Expand Down

0 comments on commit 62eec51

Please sign in to comment.