Skip to content

Conversation

@christiangoerdes
Copy link
Collaborator

@christiangoerdes christiangoerdes commented Dec 22, 2025

Summary by CodeRabbit

  • Tests
    • Enhanced test coverage for POST request handling with new test cases for empty POST bodies
    • Refactored test infrastructure with inline fixtures for improved maintainability

✏️ Tip: You can customize this high-level summary in your review settings.

@christiangoerdes christiangoerdes marked this pull request as draft December 22, 2025 14:52
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 22, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The changes consolidate test fixture data from external resource files into the test class as static string constants and add a helper method for constructing requests. A new test case for empty POST body handling is introduced, and two external test resource files are deleted.

Changes

Cohort / File(s) Summary
Test Fixtures Refactored
core/src/test/java/com/predic8/membrane/core/http/RequestTest.java
Introduced static string constants for test fixtures (POST_REQUEST, CHUNKED_REQUEST, POST_EMPTY_BODY_REQUEST); added helper method getRequest(String) to construct ByteArrayInputStream; replaced resource-loading with inline fixtures; added new inEmptyPost field and initialization; added readEmptyPost() test method to verify empty POST body handling; imported NotNull annotation.
Test Resources Deleted
core/src/test/resources/request-chunked-soap.msg, core/src/test/resources/request-post.msg
Removed external HTTP request sample files; test data now embedded as string constants in RequestTest.java.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • RequestTest.java refactoring: Review the new string constants for correct HTTP request formatting, verify the getRequest() helper normalizes line endings properly, and ensure the new readEmptyPost() test case correctly validates empty body handling.
  • Test resource deletions: Confirm no other tests reference the deleted files and that the inline constants provide equivalent coverage.

Poem

🐰 With whiskers twitching and paws so quick,
We moved the fixtures from files so thick!
Now constants bloom in the code so bright,
Testing empty posts—what a delight!
hop hop

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Empty body test' directly reflects the main change: adding a new test method (readEmptyPost) to verify handling of POST requests with empty bodies, along with refactoring test fixtures.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@membrane-ci-server
Copy link

This pull request needs "/ok-to-test" from an authorized committer.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8afa4fc and e7bd355.

📒 Files selected for processing (3)
  • core/src/test/java/com/predic8/membrane/core/http/RequestTest.java
  • core/src/test/resources/request-chunked-soap.msg
  • core/src/test/resources/request-post.msg
💤 Files with no reviewable changes (2)
  • core/src/test/resources/request-chunked-soap.msg
  • core/src/test/resources/request-post.msg
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-06-18T12:03:09.931Z
Learnt from: rrayst
Repo: membrane/api-gateway PR: 1906
File: core/src/test/java/com/predic8/membrane/core/openapi/validators/JsonSchemaTestSuiteTests.java:0-0
Timestamp: 2025-06-18T12:03:09.931Z
Learning: The mediaType method in the Request class throws jakarta.mail.internet.ParseException, not java.text.ParseException, making the jakarta.mail.internet.ParseException import necessary and correct in JsonSchemaTestSuiteTests.java.

Applied to files:

  • core/src/test/java/com/predic8/membrane/core/http/RequestTest.java
📚 Learning: 2025-09-19T11:12:26.787Z
Learnt from: predic8
Repo: membrane/api-gateway PR: 2156
File: core/src/main/java/com/predic8/membrane/core/openapi/validators/QueryParameterValidator.java:129-131
Timestamp: 2025-09-19T11:12:26.787Z
Learning: Request.get().path() in com.predic8.membrane.core.openapi.model.Request preserves the query string portion of the path, so URIFactory.createWithoutException(request.getPath()).getQuery() correctly extracts query parameters.

Applied to files:

  • core/src/test/java/com/predic8/membrane/core/http/RequestTest.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (java)
🔇 Additional comments (3)
core/src/test/java/com/predic8/membrane/core/http/RequestTest.java (3)

18-18: LGTM!

The @NotNull annotation import is correctly used in the helper method getRequest() to indicate the method never returns null.


97-99: LGTM! Well-designed helper method.

The getRequest() helper correctly normalizes text block strings into HTTP-compliant messages by removing indentation, stripping trailing whitespace, and converting line endings to CRLF format.


146-154: LGTM! Good test coverage for empty POST body.

The new test correctly validates that the request parser handles POST requests with Content-Length: 0 and an empty body. The assertions appropriately verify the method, URI, body existence, and zero length.

@predic8 predic8 closed this Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants