public NinjaRunner(Class<?> klass) throws InitializationError { super(klass); NinjaTestServer ninjaTestServer = new NinjaTestServer(); injector = ninjaTestServer.getInjector(); }
/** * Will be automatically used within the goTo() method. * * @see org.fluentlenium.adapter.FluentAdapter#getBaseUrl() */ @Override public String getBaseUrl() { return ninjaTestServer.getBaseUrl(); }
/** * Something like http://localhost:8080/ * * Will contain trailing slash! * @return */ public String getServerAddress() { return ninjaTestServer.getServerAddress(); }
@Override protected void after() { ninjaTestServer.shutdown(); ninjaTestServer = null; } };
@Override protected void before() throws Throwable { ninjaTestServer = new NinjaTestServer(NinjaMode.test); }
public Injector getInjector() { return ninjaTestServer.getInjector(); }
public URI getServerAddressAsUri() { return ninjaTestServer.getServerAddressAsUri(); }
public String getServerUrl() { return ninjaTestServer.getServerUrl(); }
@Override public void close() throws IOException { // so a test server can be used in a try-with-resources statement shutdown(); }
@Before public void startupServer() { ninjaTestServer = new NinjaTestServer(); }
public Injector getInjector() { return ninjaTestServer.getInjector(); }
private URIBuilder build(String relativePath, Map<String, String> parameters) { URIBuilder uriBuilder = new URIBuilder(ninjaTestServer.getServerAddressAsUri()).setPath(relativePath); addParametersToURI(parameters, uriBuilder); return uriBuilder; }
@Override public Url testServerUrl() { return Url.host(ninjaTestServer.getServerUrl()); }
@After public void shutdownServer() { ninjaTestServer.shutdown(); }
@Before public void startServerInTestMode() { ninjaTestServer = new NinjaTestServer(); }
public String to(String path) { if (path == null) { throw new IllegalArgumentException("Path was null"); } if (!path.startsWith("/")) { throw new IllegalArgumentException("Path must start with '/'"); } return ninjaTestServer.getBaseUrl() + path; }
public Injector getInjector(){ return ninjaTestServer.getInjector(); }
/** * @see #getBaseUrl() */ @Deprecated public String getServerAddress() { return ninjaTestServer.getServerAddress(); }
@After public void shutdownServer() { ninjaTestServer.shutdown(); }
@Before public void startNinjaServer() { ninjaTestServer = new NinjaTestServer(); }