EN · DE · RU · FR · ES

#1869: CardDavFilterTest.kt (web layer)

projectforge-carddav/src/test/kotlin/org/projectforge/carddav/config/CardDavFilterTest.kt Unit test — org.projectforge.web package, projectforge-carddav/src/test/kotlin/org/projectforge/carddav/config/CardDavFilterTest.kt 59 lines · 30 code · 22 comments · 7 blank
Web-layer test for CardDavFilter.handledByCardDavFilter() — the servlet filter decision logic. More compact than the domain-layer CardDavFilterTest (#1861), focusing on well-known URIs, DAV methods, and negative cases. Tests that only OPTIONS/PROPFIND/REPORT on known paths are intercepted, while GET requests and unknown paths pass through.

Architecture

This is a second CardDavFilterTest, located in the org.projectforge.web package (web layer). It tests the same CardDavFilter.handledByCardDavFilter() static method but with a different focus: web-layer routing concerns and the .well-known discovery endpoint.

Imports

Test Structure

Unlike #1861's flat list of test cases, this test organizes assertions using a helper method hierarchy:

Test Coverage

TestURIMethodExpectedRationale
Well-known discovery/.well-known/carddavPROPFINDtrueRFC 6764 service discovery — clients probe this path first
CardDAV users/carddav/users/PROPFINDtrueStandard CardDAV user collection path
Wicket app/wa/...PROPFINDfalseWicket application path — must NOT be intercepted
Generic GET....GETfalseGET on unknown path — not CardDAV
Users GET/usersGETfalseGET without DAV headers on users path — likely web app request
Method check: generic....OPTIONS/PROPFIND/REPORTfalseDAV methods on unknown URIs pass through
Method check: usersusersOPTIONS/PROPFIND/REPORTtrueDAV methods on "users" path are intercepted
Method check: carddav/carddav/users/OPTIONS/PROPFIND/REPORTtrueFull CardDAV path with DAV methods

Key Differences from #1861 (Domain-Layer Test)

Aspect#1861 (domain)#1869 (web)
Packageorg.projectforge.carddavorg.projectforge.web
Well-known URITests OPTIONS + GETTests PROPFIND only
Wicket pathNot testedTests /wa/... (Wicket application)
Method iterationInline checksParameterized checkMethod() with arrayOf().forEach
VCF patternsDetailed VCF filename testingNot covered
REPORT methodNot testedTested (REPORT on users/carddav paths)
Both tests (#1861 and #1869) test the same function (CardDavFilter.handledByCardDavFilter()) but from different package contexts and with different coverage. This represents test duplication likely resulting from parallel development streams that weren't fully consolidated. The domain-layer test (#1861) is more comprehensive for VCF patterns; the web-layer test (#1869) adds Wicket path exclusion and REPORT method checks.

Mocking Pattern

Same pattern as #1861: creates Mockito.mock(HttpServletRequest::class.java), stubs method and requestURI, asserts the boolean return value.

Git History

868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
40e554cbe WIP: Carddav
2ad0cfe66 WIP: Carddav
ad8b47d1f WIP: CardDavWIP: CardDav
7f2c255ae WIP: CardDav