less verbose unit tests

This commit is contained in:
Greg Wilkins 2016-03-15 18:21:09 +11:00
parent 838b5e4df2
commit 5b920700c2
2 changed files with 29 additions and 12 deletions

View File

@ -62,7 +62,7 @@ public class ContinuationsTest
@Override
public boolean add(String e)
{
System.err.printf("add(%s)%n",e);
//System.err.printf("add(%s)%n",e);
return super.add(e);
}
};
@ -332,10 +332,12 @@ public class ContinuationsTest
{
Server server = new Server();
try {
try
{
ServerConnector connector = new ServerConnector(server);
server.addConnector(connector);
if(log != null) {
if(log != null)
{
log.clear();
}
history.clear();
@ -370,7 +372,9 @@ public class ContinuationsTest
socket.getOutputStream().flush();
return toString(socket.getInputStream());
}
} finally {
}
finally
{
server.stop();
if (log != null)
@ -640,7 +644,8 @@ public class ContinuationsTest
{
private final List<String> log;
public Log(List<String> log) {
public Log(List<String> log)
{
this.log = log;
}

View File

@ -32,6 +32,7 @@ import java.util.List;
import java.util.TimeZone;
import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.http.HttpParser;
import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.http.HttpTester;
import org.eclipse.jetty.test.support.StringUtil;
@ -41,6 +42,9 @@ import org.eclipse.jetty.test.support.rawhttp.HttpTesting;
import org.eclipse.jetty.toolchain.test.FS;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.toolchain.test.StringAssert;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.StdErrLog;
import org.hamcrest.Matchers;
import org.junit.AfterClass;
import org.junit.Assert;
@ -1444,15 +1448,23 @@ public abstract class RFC2616BaseTest
public void test14_23_IncompleteHostHeader() throws Exception
{
// HTTP/1.1 - Incomplete (empty) Host header
try
{
((StdErrLog)Log.getLogger(HttpParser.class)).setHideStacks(true);
StringBuffer req4 = new StringBuffer();
req4.append("GET /tests/R1.txt HTTP/1.1\n");
req4.append("Host:\n");
req4.append("Connection: close\n");
req4.append("\n");
StringBuffer req4 = new StringBuffer();
req4.append("GET /tests/R1.txt HTTP/1.1\n");
req4.append("Host:\n");
req4.append("Connection: close\n");
req4.append("\n");
HttpTester.Response response = http.request(req4);
assertEquals("14.23 HTTP/1.1 - Empty Host", HttpStatus.BAD_REQUEST_400, response.getStatus());
HttpTester.Response response = http.request(req4);
assertEquals("14.23 HTTP/1.1 - Empty Host", HttpStatus.BAD_REQUEST_400, response.getStatus());
}
finally
{
((StdErrLog)Log.getLogger(HttpParser.class)).setHideStacks(false);
}
}
/**