-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4de5a1f
commit b05fe3f
Showing
3 changed files
with
85 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
htmlelements-java/src/test/java/ru/yandex/qatools/htmlelements/NonElementFieldsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package ru.yandex.qatools.htmlelements; | ||
|
||
import org.junit.Test; | ||
import ru.yandex.qatools.htmlelements.testpages.NonElementFieldsPage; | ||
|
||
import static org.hamcrest.CoreMatchers.nullValue; | ||
import static org.hamcrest.Matchers.emptyCollectionOf; | ||
import static org.hamcrest.Matchers.is; | ||
import static org.junit.Assert.assertThat; | ||
|
||
/** | ||
* @author Graham Russell [email protected] | ||
* Date: 24.10.2015 | ||
*/ | ||
public class NonElementFieldsTest { | ||
|
||
@Test | ||
public void nonElementPrivateFieldsShouldNotBeDecoratedAsElements() { | ||
|
||
NonElementFieldsPage page = new NonElementFieldsPage(); | ||
|
||
assertThat("Non-WebElement/HtmlElement fields are not touched", | ||
page.rowsCache, is(nullValue())); | ||
assertThat("Non-WebElement/HtmlElement fields are not touched", | ||
page.rowsAsStringCache, is(nullValue())); | ||
assertThat("Non-WebElement/HtmlElement fields are not touched", | ||
page.otherCache, is(emptyCollectionOf(String.class))); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...nts-java/src/test/java/ru/yandex/qatools/htmlelements/testpages/NonElementFieldsPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package ru.yandex.qatools.htmlelements.testpages; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import ru.yandex.qatools.htmlelements.loader.HtmlElementLoader; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static org.mockito.Mockito.mock; | ||
|
||
/** | ||
* @author Graham Russell [email protected] | ||
* Date: 24.10.2015 | ||
*/ | ||
public class NonElementFieldsPage { | ||
|
||
// public for ease of assertion in test | ||
public List<List<WebElement>> rowsCache; | ||
public List<List<String>> rowsAsStringCache; | ||
public List<String> otherCache = new ArrayList<>(); | ||
|
||
public NonElementFieldsPage() { | ||
this(mockDriver()); | ||
} | ||
|
||
public NonElementFieldsPage(WebDriver driver) { | ||
HtmlElementLoader.populatePageObject(this, driver); | ||
} | ||
|
||
public static WebDriver mockDriver() { | ||
return mock(WebDriver.class); | ||
} | ||
} |