Skip to content

Commit

Permalink
Fixes HarResultsTest on Windows
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Andy Clark committed Dec 24, 2013
1 parent 401c8f1 commit 427a240
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/test/java/net/lightbody/bmp/proxy/HarResultsTest.java
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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());
}

Expand Down

0 comments on commit 427a240

Please sign in to comment.