Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,8 +23,6 @@ import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.After;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -36,12 +34,16 @@ import org.springframework.http.StreamingHttpOutputMessage;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
/** @author Arjen Poutsma */
|
||||
public abstract class AbstractHttpRequestFactoryTestCase extends
|
||||
AbstractJettyServerTestCase {
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
public abstract class AbstractHttpRequestFactoryTestCase extends AbstractJettyServerTestCase {
|
||||
|
||||
protected ClientHttpRequestFactory factory;
|
||||
|
||||
|
||||
@Before
|
||||
public final void createFactory() throws Exception {
|
||||
factory = createRequestFactory();
|
||||
@@ -60,6 +62,7 @@ public abstract class AbstractHttpRequestFactoryTestCase extends
|
||||
|
||||
protected abstract ClientHttpRequestFactory createRequestFactory();
|
||||
|
||||
|
||||
@Test
|
||||
public void status() throws Exception {
|
||||
URI uri = new URI(baseUrl + "/status/notfound");
|
||||
|
||||
@@ -38,13 +38,16 @@ import org.junit.BeforeClass;
|
||||
import org.springframework.util.SocketUtils;
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
/** @author Arjen Poutsma */
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
public abstract class AbstractJettyServerTestCase {
|
||||
|
||||
protected static String baseUrl;
|
||||
|
||||
private static Server jettyServer;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void startJettyServer() throws Exception {
|
||||
int port = SocketUtils.findAvailableTcpPort();
|
||||
@@ -77,6 +80,7 @@ public abstract class AbstractJettyServerTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Servlet that sets a given status code.
|
||||
*/
|
||||
@@ -96,6 +100,7 @@ public abstract class AbstractJettyServerTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class MethodServlet extends GenericServlet {
|
||||
|
||||
@@ -114,6 +119,7 @@ public abstract class AbstractJettyServerTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class PostServlet extends MethodServlet {
|
||||
|
||||
@@ -138,6 +144,7 @@ public abstract class AbstractJettyServerTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class EchoServlet extends HttpServlet {
|
||||
|
||||
@@ -161,12 +168,12 @@ public abstract class AbstractJettyServerTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class ParameterServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
protected void service(HttpServletRequest req, HttpServletResponse resp)
|
||||
throws ServletException, IOException {
|
||||
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
Map<String, String[]> parameters = req.getParameterMap();
|
||||
assertEquals(2, parameters.size());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user