dotCMS / dotCMS/core

Add web layer tests using MockMvc

Open
#35,055 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dotCMS : Analytics Priority : 4 Low Team : Falcon Type : Test Automation
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Description

Add controller-level tests using MockMvc. These tests sit at the web layer — no real ClickHouse or service infrastructure needed. They verify that each endpoint correctly handles request validation, auth header parsing, error conditions, and returns the right HTTP status codes.

This issue depends on #35050 (ingest code refactor) being complete.

Parent epic: #35048

Acceptance Criteria

  • MockMvc tests added for all controller endpoints
  • Auth header parsing tested: X-Customer-Id and X-Signature — valid, missing, and malformed cases
  • Request validation tested: missing required params, invalid formats, out-of-range values
  • Error responses tested: correct HTTP status codes and response body shape for each error condition
  • Happy path tested: valid request returns expected 2xx status and response structure
  • Tests run without external infrastructure (no ClickHouse, no Docker)

Additional Context

  • Source task: Task 5 (Web layer tests) from the improvement plan
  • Blocked by: #35050 (ingest code refactor must be done first)
  • Framework: Spring Boot Test + MockMvc
  • Headers under test: X-Customer-Id, X-Signature (HMAC SHA-256)
  • Related branch: issue-34849-Add-dotCMS-Analytics-Proxy-Endpoint-for-/v1/analytics/-to-dot-ca-event-manager

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the controller endpoints and the existing Spring Boot Test setup, then review the dependency on #35050 before writing MockMvc tests. Cover the listed auth-header, validation, error, and happy-path cases, and run the tests without ClickHouse or Docker; done means all controller endpoints meet the acceptance criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
api, backend, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.