forked from jooby-project/jooby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIssue1822.java
More file actions
30 lines (24 loc) · 837 Bytes
/
Issue1822.java
File metadata and controls
30 lines (24 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package io.jooby.internal;
import io.jooby.MessageEncoder;
import io.jooby.Route;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class Issue1822 {
@Test
public void routerExistsShouldNotReturnsFalsePositives() {
String pattern = "/api/*";
String path = "/";
Chi router = new Chi();
router.insert(route("GET", pattern, stringHandler("api")));
assertFalse(router.exists("GET", path));
assertTrue(router.exists("GET", "/api/v1"));
}
private Route.Handler stringHandler(String foo) {
return ctx -> foo;
}
private Route route(String method, String pattern, Route.Handler handler) {
return new Route(method, pattern, handler)
.setEncoder(MessageEncoder.TO_STRING);
}
}