GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — add closure test · Xiermires/EntityMatcher@a8c6a46

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/test/java/org/matcher
    • bean
      • BeanBasedEntityMatcherTest.java
    • name
      • NameBasedEntityMatcherTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/test/java/org/matcher/bean/BeanBasedEntityMatcherTest.java‎

Copy file name to clipboardExpand all lines: src/test/java/org/matcher/bean/BeanBasedEntityMatcherTest.java
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.matcher.bean;
22

3+
import static org.hamcrest.Matchers.either;
34
import static org.hamcrest.Matchers.greaterThan;
45
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
56
import static org.hamcrest.Matchers.is;
@@ -8,6 +9,7 @@
89
import static org.hamcrest.Matchers.nullValue;
910
import static org.hamcrest.Matchers.startsWith;
1011
import static org.junit.Assert.assertThat;
12+
import static org.matcher.Expressions.closure;
1113
import static org.matcher.Expressions.not;
1214
import static org.matcher.bean.BeanBasedExpressions.between;
1315
import static org.matcher.bean.BeanBasedExpressions.count;
@@ -196,6 +198,16 @@ public void testNotNot() {
196198
assertThat(bars.contains(t.getBar()), is(true));
197199
}
198200

201+
@Test
202+
public void testClosure() {
203+
final TestOther to = BeanBasedMatcher.matcher(TestOther.class);
204+
final List<TestOther> tos = matcher.find(TestOther.class, matching(to.getBar(), eq("Snake")).and(to.getFoo(), closure(eq(5).or(eq(3)))));
205+
for (TestOther t : tos) {
206+
assertThat(t.getBar(), is("Snake"));
207+
assertThat(t.getFoo(), either(is(5)).or(is(3)));
208+
}
209+
}
210+
199211
@Test
200212
public void testBetween() {
201213
final TestClass tc = BeanBasedMatcher.matcher(TestClass.class);
Collapse file

‎src/test/java/org/matcher/name/NameBasedEntityMatcherTest.java‎

Copy file name to clipboardExpand all lines: src/test/java/org/matcher/name/NameBasedEntityMatcherTest.java
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*******************************************************************************/
2222
package org.matcher.name;
2323

24+
import static org.hamcrest.Matchers.either;
2425
import static org.hamcrest.Matchers.greaterThan;
2526
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
2627
import static org.hamcrest.Matchers.is;
@@ -29,6 +30,7 @@
2930
import static org.hamcrest.Matchers.nullValue;
3031
import static org.hamcrest.Matchers.startsWith;
3132
import static org.junit.Assert.assertThat;
33+
import static org.matcher.Expressions.closure;
3234
import static org.matcher.Expressions.not;
3335
import static org.matcher.name.NameBasedExpressions.between;
3436
import static org.matcher.name.NameBasedExpressions.count;
@@ -198,6 +200,15 @@ public void testNotNot() {
198200
for (TestClass tc : tcs)
199201
assertThat(bars.contains(tc.getBar()), is(true));
200202
}
203+
204+
@Test
205+
public void testClosure() {
206+
final List<TestOther> tos = matcher.find(TestOther.class, matching("bar", eq("Snake")).and("foo", closure(eq(5).or(eq(3)))));
207+
for (TestOther to : tos) {
208+
assertThat(to.getBar(), is("Snake"));
209+
assertThat(to.getFoo(), either(is(5)).or(is(3)));
210+
}
211+
}
201212

202213
@Test
203214
public void testBetween() {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.