|
1 | 1 | package org.javawebstack.framework.testing; |
2 | 2 |
|
| 3 | +import org.javawebstack.command.CommandResult; |
3 | 4 | import org.javawebstack.framework.WebApplication; |
| 5 | +import org.javawebstack.framework.config.Config; |
4 | 6 | import org.javawebstack.httpserver.test.HTTPTest; |
| 7 | +import org.javawebstack.injector.Injector; |
5 | 8 |
|
6 | | -public abstract class WebFrameworkTest { |
| 9 | +public abstract class WebFrameworkTest extends HTTPTest { |
7 | 10 |
|
8 | | - private HTTPTest httpTest; |
9 | 11 | private WebApplication webApplication; |
10 | 12 |
|
11 | 13 | public WebFrameworkTest(WebApplication webApplication){ |
| 14 | + super(webApplication.getServer()); |
| 15 | + webApplication.getInjector().inject(this); |
| 16 | + |
12 | 17 | this.webApplication = webApplication; |
13 | | - httpTest = new HTTPTest(webApplication.getServer()) {}; |
14 | 18 | } |
15 | 19 |
|
16 | | - public HTTPTest getHttpTest() { |
17 | | - return httpTest; |
| 20 | + public WebApplication getApplication() { |
| 21 | + return webApplication; |
18 | 22 | } |
19 | 23 |
|
20 | | - public WebApplication getWebApplication() { |
21 | | - return webApplication; |
| 24 | + public Injector getInjector(){ |
| 25 | + return webApplication.getInjector(); |
| 26 | + } |
| 27 | + |
| 28 | + public void seed(String name){ |
| 29 | + webApplication.getSeeder(name).seed(); |
| 30 | + } |
| 31 | + |
| 32 | + public CommandResult runCommand(String... input){ |
| 33 | + return webApplication.getCommandSystem().eval(input); |
| 34 | + } |
| 35 | + |
| 36 | + public Config getConfig(){ |
| 37 | + return webApplication.getConfig(); |
22 | 38 | } |
23 | 39 | } |
0 commit comments