<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<scope>test</scope>
</dependency>
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
public class WebAppTest {
private static Server server;
@BeforeClass
public static void setup() throws Exception {
server = new Server(8080);
WebAppContext webAppContext = new WebAppContext();
webAppContext.setContextPath("/");
webAppContext.setBaseResource(Resource.newResource("src/main/webapp"));
server.setHandler(webAppContext);
server.start();
}
@Test
public void testWebApp() throws Exception {
}
@AfterClass
public static void teardown() throws Exception {
server.stop();
}
}