Skip to content

Commit 176763d

Browse files
committed
Added inject method for WebFrameworkTest
1 parent 2eb055b commit 176763d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/java/org/javawebstack/framework/testing/WebFrameworkTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.javawebstack.framework.WebApplication;
44
import org.javawebstack.httpserver.test.HTTPTest;
5+
import org.javawebstack.injector.Injector;
56

67
public abstract class WebFrameworkTest extends HTTPTest {
78

@@ -15,4 +16,16 @@ public WebFrameworkTest(WebApplication webApplication){
1516
public WebApplication getWebApplication() {
1617
return webApplication;
1718
}
19+
20+
public Injector getInjector(){
21+
return webApplication.getInjector();
22+
}
23+
24+
public <T> T inject(Class<T> clazz){
25+
return webApplication.getInjector().getInstance(clazz);
26+
}
27+
28+
public <T> T inject(Class<T> clazz, String name){
29+
return webApplication.getInjector().getInstance(clazz, name);
30+
}
1831
}

0 commit comments

Comments
 (0)