Writing automatic tests requiring external resources

Version 1 by Christophe DENEUX
on Jul 04, 2014 19:03.

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (8)

View Page History
h4. Working with {{FileServlet}}

The reply of this servlet is the content of a file:
* the content-type that has been set when creating the servlet,
* the content of the given file when creating the servlet.
{code}

public static class HasWebServer {
@Rule

// ...
final AbstractHttpServlet fileServlet = new FileServlet(
new File(Thread.currentThread().getContextClassLoader().getResource("my-file").toURI()),
final AbstractHttpServlet fileServlet = new FileServlet(localArtifact, MimeTypeConstants.APPLICATION_ZIP);
MimeTypeConstants.APPLICATION_ZIP);
this.webServer.addServlet(servlet, servletPath); this.webServer.addServlet(fileServlet, fileServlet.getPath());
// ...
}