forked from jooby-project/jooby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIssue1552.java
More file actions
73 lines (53 loc) · 3.1 KB
/
Copy pathIssue1552.java
File metadata and controls
73 lines (53 loc) · 3.1 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
64
65
66
67
68
69
70
71
72
73
package tests;
import io.jooby.Context;
import io.jooby.MockRouter;
import io.jooby.apt.MvcModuleCompilerRunner;
import source.Controller1552;
import source.Controller1552Empty;
import source.JavaBeanParam;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
public class Issue1552 {
@Test
public void inherited() throws Exception {
new MvcModuleCompilerRunner(new Controller1552())
.module(app -> {
MockRouter router = new MockRouter(app);
assertEquals("/inherited", router.get("/inherited").value());
assertEquals(Arrays.asList("/inherited/subpath"), router.get("/inherited/subpath").value());
assertTrue(router.get("/inherited/object").value() instanceof Context);
assertTrue(router.post("/inherited/post").value() instanceof JavaBeanParam);
assertEquals("/inherited/postOnly", router.post("/inherited/postOnly").value());
assertEquals("/inherited/pathAttributeWork", router.get("/inherited/pathAttributeWork").value());
assertEquals("/inherited/path", router.get("/inherited/path").value());
assertEquals("/inherited/value", router.get("/inherited/value").value());
assertEquals("/inherited/path1", router.get("/inherited/path1").value());
assertEquals("/inherited/path2", router.get("/inherited/path2").value());
assertEquals("/inherited/childOnly", router.get("/inherited/childOnly").value());
assertEquals("/inherited/childOnly", router.post("/inherited/childOnly").value());
assertEquals("/inherited/path1", router.post("/inherited/path1").value());
assertEquals("/inherited/path2", router.post("/inherited/path2").value());
});
}
@Test
public void inherited_empty() throws Exception {
new MvcModuleCompilerRunner(new Controller1552Empty())
.module(app -> {
MockRouter router = new MockRouter(app);
assertEquals("/inherit_empty", router.get("/inherit_empty").value());
assertEquals(Arrays.asList("/inherit_empty/subpath"), router.get("/inherit_empty/subpath").value());
assertTrue(router.get("/inherit_empty/object").value() instanceof Context);
assertTrue(router.post("/inherit_empty/post").value() instanceof JavaBeanParam);
assertEquals("/inherit_empty/postOnly", router.post("/inherit_empty/postOnly").value());
assertEquals("/inherit_empty/pathAttributeWork", router.get("/inherit_empty/pathAttributeWork").value());
assertEquals("/inherit_empty/path", router.get("/inherit_empty/path").value());
assertEquals("/inherit_empty/value", router.get("/inherit_empty/value").value());
assertEquals("/inherit_empty/path1", router.get("/inherit_empty/path1").value());
assertEquals("/inherit_empty/path2", router.get("/inherit_empty/path2").value());
assertEquals("/inherit_empty/path1", router.post("/inherit_empty/path1").value());
assertEquals("/inherit_empty/path2", router.post("/inherit_empty/path2").value());
});
}
}