From 427a24073022bb3c277247ff8fd4cbd66155c458 Mon Sep 17 00:00:00 2001 From: Andy Clark Date: Tue, 24 Dec 2013 22:25:38 +0000 Subject: [PATCH] Fixes HarResultsTest on Windows The headers coming back from the server depend on which platform Jetty is running on. From evidence on github and my own machine, it seems that they're 226 bytes long on Win, and 227 elsewhere. That being said, the sample size is very low, and it would be better to calculate the expected header size as part of the test. But I'm not sure I understand the intention behind the test well enough to do that. --- .../java/net/lightbody/bmp/proxy/HarResultsTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/test/java/net/lightbody/bmp/proxy/HarResultsTest.java b/src/test/java/net/lightbody/bmp/proxy/HarResultsTest.java index b8ef943a1..da112a6c0 100644 --- a/src/test/java/net/lightbody/bmp/proxy/HarResultsTest.java +++ b/src/test/java/net/lightbody/bmp/proxy/HarResultsTest.java @@ -1,14 +1,16 @@ package net.lightbody.bmp.proxy; +import java.util.List; + import net.lightbody.bmp.core.har.Har; import net.lightbody.bmp.core.har.HarEntry; import net.lightbody.bmp.core.har.HarLog; + import org.apache.http.client.methods.HttpGet; +import static org.hamcrest.CoreMatchers.*; import org.junit.Assert; import org.junit.Test; -import java.util.List; - public class HarResultsTest extends DummyServerTest { @Test public void testRequestAndResponseSizesAreSet() throws Exception { @@ -28,7 +30,8 @@ public void testRequestAndResponseSizesAreSet() throws Exception { Assert.assertEquals(100, entry.getRequest().getHeadersSize()); Assert.assertEquals(0, entry.getRequest().getBodySize()); - Assert.assertEquals(227, entry.getResponse().getHeadersSize()); + // 226 for Windows, 227 for other platforms? Can it be that simple? + Assert.assertThat((int)entry.getResponse().getHeadersSize(), anyOf(is(226),is(227))); Assert.assertEquals(13, entry.getResponse().getBodySize()); }