Skip to content

Commit c1e3fa2

Browse files
committed
yet more coverage for PageConfig#isNotModified()
1 parent 18ff126 commit c1e3fa2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

opengrok-web/src/test/java/org/opengrok/web/PageConfigTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,26 @@ public String getPathInfo() {
657657
};
658658
}
659659

660+
@Test
661+
void testIsNotModifiedNullHeaderEtag() throws IOException {
662+
HttpServletRequest req = new DummyHttpServletRequest() {
663+
@Override
664+
public String getHeader(String name) {
665+
return null;
666+
}
667+
668+
@Override
669+
public String getPathInfo() {
670+
return "path";
671+
}
672+
};
673+
674+
PageConfig cfg = PageConfig.get(req);
675+
HttpServletResponse resp = mock(HttpServletResponse.class);
676+
assertFalse(cfg.isNotModified(req, resp));
677+
verify(resp).setHeader(eq(HttpHeaders.ETAG), startsWith("W/"));
678+
}
679+
660680
@ParameterizedTest
661681
@ValueSource(booleans = {true, false})
662682
void testIsNotModifiedEtag(boolean createTimestamp) throws IOException {

0 commit comments

Comments
 (0)