14
14
* limitations under the License.
15
15
*/
16
16
17
- package io .github .seleniumquery .functions .jquery .traversing .filtering ;
17
+ package io .github .seleniumquery .functions .jquery .traversing .filtering . filterfunction ;
18
18
19
19
import com .google .common .base .Predicate ;
20
20
import io .github .seleniumquery .SeleniumQueryObject ;
21
- import org .hamcrest .collection .IsEmptyCollection ;
22
21
import org .junit .Test ;
23
22
import org .openqa .selenium .WebElement ;
24
23
25
24
import static org .hamcrest .CoreMatchers .is ;
26
25
import static org .hamcrest .collection .IsEmptyCollection .empty ;
27
- import static org .hamcrest .collection .IsIterableContainingInAnyOrder .containsInAnyOrder ;
28
26
import static org .hamcrest .collection .IsIterableContainingInOrder .contains ;
29
27
import static org .junit .Assert .assertThat ;
30
- import static testinfrastructure .testdouble .Dummies .createDummyWebElement ;
31
- import static testinfrastructure .testdouble .SeleniumQueryObjectMother .createStubSeleniumQueryObject ;
32
- import static testinfrastructure .testdouble .SeleniumQueryObjectMother .createStubSeleniumQueryObjectWithAtLeastOneElement ;
33
- import static testinfrastructure .testdouble .SeleniumQueryObjectMother .createStubSeleniumQueryObjectWithElements ;
28
+ import static testinfrastructure .testdouble .SeleniumQueryObjectMother .*;
34
29
import static testinfrastructure .testdouble .Stubs .createStubWebElementWithTag ;
35
30
36
- public class FilterFunctionTest {
31
+ public class FilterPredicateFunctionTest {
37
32
38
33
private static final Predicate <WebElement > NULL_PREDICATE = null ;
39
34
40
- FilterFunction filterFunction = new FilterFunction ();
35
+ FilterPredicateFunction filterPredicateFunction = new FilterPredicateFunction ();
41
36
42
37
@ Test
43
38
public void null_predicate__should_return_EMPTY_elements () {
44
39
// given
45
40
SeleniumQueryObject targetSQO = createStubSeleniumQueryObjectWithAtLeastOneElement ();
46
41
// when
47
- SeleniumQueryObject resultSQO = filterFunction .filter (targetSQO , NULL_PREDICATE );
42
+ SeleniumQueryObject resultSQO = filterPredicateFunction .filter (targetSQO , NULL_PREDICATE );
48
43
// then
49
44
assertThat (resultSQO .get (), empty ());
50
45
}
@@ -54,7 +49,7 @@ public void resultSQO_should_have_targetSQO_as_previous_object() {
54
49
// given
55
50
SeleniumQueryObject targetSQO = createStubSeleniumQueryObject ();
56
51
// when
57
- SeleniumQueryObject resultSQO = filterFunction .filter (targetSQO , NULL_PREDICATE );
52
+ SeleniumQueryObject resultSQO = filterPredicateFunction .filter (targetSQO , NULL_PREDICATE );
58
53
// then
59
54
assertThat (resultSQO .end (), is (targetSQO ));
60
55
}
@@ -64,7 +59,7 @@ public void resultSQO_should_have_same_SQFunctions_as_targetSQO() {
64
59
// given
65
60
SeleniumQueryObject targetSQO = createStubSeleniumQueryObject ();
66
61
// when
67
- SeleniumQueryObject resultSQO = filterFunction .filter (targetSQO , NULL_PREDICATE );
62
+ SeleniumQueryObject resultSQO = filterPredicateFunction .filter (targetSQO , NULL_PREDICATE );
68
63
// then
69
64
assertThat (resultSQO .getSeleniumQueryFunctions (), is (targetSQO .getSeleniumQueryFunctions ()));
70
65
}
@@ -74,7 +69,7 @@ public void resultSQO_should_have_same_WebDriver_as_targetSQO() {
74
69
// given
75
70
SeleniumQueryObject targetSQO = createStubSeleniumQueryObject ();
76
71
// when
77
- SeleniumQueryObject resultSQO = filterFunction .filter (targetSQO , NULL_PREDICATE );
72
+ SeleniumQueryObject resultSQO = filterPredicateFunction .filter (targetSQO , NULL_PREDICATE );
78
73
// then
79
74
assertThat (resultSQO .getWebDriver (), is (targetSQO .getWebDriver ()));
80
75
}
@@ -94,7 +89,7 @@ public boolean apply(WebElement webElement) {
94
89
return "span" .equals (webElement .getTagName ());
95
90
}
96
91
};
97
- SeleniumQueryObject resultSQO = filterFunction .filter (targetSQO , keepSpansPredicate );
92
+ SeleniumQueryObject resultSQO = filterPredicateFunction .filter (targetSQO , keepSpansPredicate );
98
93
// then
99
94
assertThat (resultSQO .get (), contains (spanOne , spanTwo ));
100
95
}
0 commit comments