when(session.getVersion()).thenReturn(VERSION);
}
private String fillPushStrategyCache(Fields requestHeaders)
{
Set<String> pushResources = referrerPushStrategy.apply(stream, requestHeaders, new Fields());
assertThat("pushResources is empty", pushResources.size(), is(0));
String origin = SCHEME + "://" + HOST;
String referrerUrl = origin + MAIN_URI;
requestHeaders.put(HTTPSPDYHeader.URI.name(VERSION), "image.jpg");
requestHeaders.put("referer", referrerUrl);
pushResources = referrerPushStrategy.apply(stream, requestHeaders, new Fields());
assertThat("pushResources is empty", pushResources.size(), is(0));
requestHeaders.put(HTTPSPDYHeader.URI.name(VERSION), "style.css");
pushResources = referrerPushStrategy.apply(stream, requestHeaders, new Fields());
assertThat("pushResources is empty", pushResources.size(), is(0));
requestHeaders.put(HTTPSPDYHeader.URI.name(VERSION), MAIN_URI);
pushResources = referrerPushStrategy.apply(stream, requestHeaders, new Fields());
assertThat("pushResources contains two elements image.jpg and style.css", pushResources.size(), is(2));
return referrerUrl;
}