summaryrefslogtreecommitdiffstats
path: root/jdisc_core/src/test
diff options
context:
space:
mode:
authorArne Juul <arnej@yahoo-inc.com>2017-11-09 21:16:51 +0000
committerArne Juul <arnej@yahoo-inc.com>2017-11-09 21:16:51 +0000
commit5bc7413e1af6272b172d1ccd293235a2202f368a (patch)
tree6c34a440e614c5548173b3b5c40b0ae6477bdb5c /jdisc_core/src/test
parent310675a44a01e9f671b06d63a2043cdad2cfc58a (diff)
add the pattern to BindingMatch
Diffstat (limited to 'jdisc_core/src/test')
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/RequestTestCase.java7
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingMatchTestCase.java14
2 files changed, 13 insertions, 8 deletions
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/RequestTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/RequestTestCase.java
index e00bdae153d..cd5e07f1224 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/RequestTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/RequestTestCase.java
@@ -297,9 +297,10 @@ public class RequestTestCase {
public RequestHandler resolveHandler(Request request) {
this.asServer = request.isServerRequest();
RequestHandler requestHandler = new MyRequestHandler();
- request.setBindingMatch(new BindingMatch<>(
- new UriPattern("http://*/*").match(request.getUri()),
- requestHandler));
+ UriPattern pattern = new UriPattern("http://*/*");
+ request.setBindingMatch(new BindingMatch<>(pattern.match(request.getUri()),
+ requestHandler,
+ pattern));
return requestHandler;
}
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingMatchTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingMatchTestCase.java
index 582a1c6685e..21a3ae08c49 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingMatchTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingMatchTestCase.java
@@ -18,32 +18,36 @@ public class BindingMatchTestCase {
@Test
public void requireThatAccessorsWork() {
Object obj = new Object();
+ UriPattern pattern = new UriPattern("http://*/*");
BindingMatch<Object> match = new BindingMatch<>(
- new UriPattern("http://*/*").match(URI.create("http://localhost:69/status.html")),
- obj);
+ pattern.match(URI.create("http://localhost:69/status.html")),
+ obj, pattern);
assertSame(obj, match.target());
assertEquals(3, match.groupCount());
assertEquals("localhost", match.group(0));
assertEquals("69", match.group(1));
assertEquals("status.html", match.group(2));
+ assertEquals(pattern, match.matched());
}
@Test
public void requireThatConstructorArgumentsCanNotBeNull() {
try {
- new BindingMatch<>(null, null);
+ new BindingMatch<>(null, null, null);
fail();
} catch (NullPointerException e) {
}
try {
- new BindingMatch<>(new UriPattern("http://*/*").match(URI.create("http://localhost/")), null);
+ UriPattern pattern = new UriPattern("http://*/*");
+ new BindingMatch<>(pattern.match(URI.create("http://localhost/")), null, pattern);
fail();
} catch (NullPointerException e) {
}
try {
- new BindingMatch<>(null, new Object());
+ UriPattern pattern = new UriPattern("http://*/*");
+ new BindingMatch<>(null, new Object(), pattern);
fail();
} catch (NullPointerException e) {