Skip to content

Commit 427a240

Browse files
author
Andy Clark
committed
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.
1 parent 401c8f1 commit 427a240

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/test/java/net/lightbody/bmp/proxy/HarResultsTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
package net.lightbody.bmp.proxy;
22

3+
import java.util.List;
4+
35
import net.lightbody.bmp.core.har.Har;
46
import net.lightbody.bmp.core.har.HarEntry;
57
import net.lightbody.bmp.core.har.HarLog;
8+
69
import org.apache.http.client.methods.HttpGet;
10+
import static org.hamcrest.CoreMatchers.*;
711
import org.junit.Assert;
812
import org.junit.Test;
913

10-
import java.util.List;
11-
1214
public class HarResultsTest extends DummyServerTest {
1315
@Test
1416
public void testRequestAndResponseSizesAreSet() throws Exception {
@@ -28,7 +30,8 @@ public void testRequestAndResponseSizesAreSet() throws Exception {
2830

2931
Assert.assertEquals(100, entry.getRequest().getHeadersSize());
3032
Assert.assertEquals(0, entry.getRequest().getBodySize());
31-
Assert.assertEquals(227, entry.getResponse().getHeadersSize());
33+
// 226 for Windows, 227 for other platforms? Can it be that simple?
34+
Assert.assertThat((int)entry.getResponse().getHeadersSize(), anyOf(is(226),is(227)));
3235
Assert.assertEquals(13, entry.getResponse().getBodySize());
3336
}
3437

0 commit comments

Comments
 (0)