-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #778 from jooby-project/767
Require doesnt work in routes defined on a separate file. fix #767
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
coverage-report/src/test/java/org/jooby/issues/Issue767.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.jooby.issues; | ||
|
||
import org.jooby.Jooby; | ||
import org.jooby.test.ServerFeature; | ||
import org.junit.Test; | ||
|
||
public class Issue767 extends ServerFeature { | ||
|
||
public static class Service { | ||
public String doWork() { | ||
return "OK"; | ||
} | ||
} | ||
|
||
public static class Foo extends Jooby { | ||
{ | ||
get("/foo", () -> require(Service.class).doWork()); | ||
} | ||
} | ||
|
||
{ | ||
get("/767", () -> require(Service.class).doWork()); | ||
|
||
use("/767", new Foo()); | ||
} | ||
|
||
@Test | ||
public void shouldHaveAccessFromTopApp() throws Exception { | ||
request() | ||
.get("/767") | ||
.expect("OK"); | ||
} | ||
|
||
@Test | ||
public void shouldHaveAccessFromSubApp() throws Exception { | ||
request() | ||
.get("/767/foo") | ||
.expect("OK"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters