-
-
Notifications
You must be signed in to change notification settings - Fork 201
Expand file tree
/
Copy pathIssue1515.java
More file actions
63 lines (53 loc) · 1.59 KB
/
Copy pathIssue1515.java
File metadata and controls
63 lines (53 loc) · 1.59 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* Jooby https://jooby.io
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
* Copyright 2014 Edgar Espina
*/
package io.jooby.test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import io.jooby.junit.ServerTest;
import io.jooby.junit.ServerTestRunner;
public class Issue1515 {
@ServerTest
public void issue1515(ServerTestRunner runner) {
runner
.define(
app -> {
app.get("/{lang:[a-z]{2}}/{page:[^.]+}/", ctx -> ctx.pathMap());
app.get("/{lang:[a-z]{2}}/", ctx -> ctx.pathMap());
})
.ready(
client -> {
client.get(
"/ar/page/",
rsp -> {
assertEquals("{lang=ar, page=page}", rsp.body().string());
});
client.get(
"/12/page/",
rsp -> {
assertEquals(404, rsp.code());
});
client.get(
"/abc/page/",
rsp -> {
assertEquals(404, rsp.code());
});
client.get(
"/ar/",
rsp -> {
assertEquals("{lang=ar}", rsp.body().string());
});
client.get(
"/12/",
rsp -> {
assertEquals(404, rsp.code());
});
client.get(
"/abc/",
rsp -> {
assertEquals(404, rsp.code());
});
});
}
}