forked from codeborne/play-guice
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #3 from qudini/codeborne-master
Update from codebourne master
- Loading branch information
Showing
5 changed files
with
46 additions
and
29 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
self: play-guice -> guice 1.8 | ||
self: play-guice -> guice 1.10 | ||
|
||
require: | ||
- play 1.5.+ | ||
- com.google.inject -> guice 4.1.0: | ||
transitive: true | ||
transitive: false | ||
- com.google.inject.extensions -> guice-multibindings 4.1.0: | ||
transitive: false | ||
- aopalliance 1.0: | ||
transitive: true | ||
transitive: false | ||
- com.google.guava -> guava 23.0 |
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
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
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 |
---|---|---|
@@ -1,29 +1,15 @@ | ||
package play.modules.guice; | ||
|
||
import org.junit.Test; | ||
import play.mvc.Controller; | ||
import play.mvc.Http; | ||
|
||
import static org.hamcrest.core.Is.is; | ||
import static org.junit.Assert.assertThat; | ||
import static org.junit.Assert.assertNull; | ||
|
||
public class GuicePluginTest { | ||
@Test | ||
public void createNonStaticControllerInstance() throws Exception { | ||
Http.Request.current.set(new Http.Request()); | ||
NonStaticController controllerBean = new NonStaticController(); | ||
public void getBeanOfType_returnsNull_ifInjectorIsNull() { | ||
GuicePlugin plugin = new GuicePlugin(); | ||
plugin.injector = null; | ||
|
||
GuicePlugin plugin = new GuicePlugin() { | ||
@Override public <T> T getBeanOfType(Class<T> clazz) { | ||
return (T) controllerBean; | ||
} | ||
}; | ||
plugin.beforeActionInvocation(NonStaticController.class.getMethod("hello")); | ||
|
||
assertThat(Http.Request.current().controllerInstance, is(controllerBean)); | ||
} | ||
|
||
static class NonStaticController extends Controller { | ||
public void hello() {} | ||
assertNull(plugin.getBeanOfType(String.class)); | ||
} | ||
} |