Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jul 11, 2025

Add integration test for CodeReviewPrompts

Summary

Added a new integration test CodeReviewPromptsIT that tests the code review prompt functionality via the MCP prompts/get endpoint. This is the first integration test for prompts in the codebase - all previous integration tests were for tools only.

The test follows the existing pattern established by HelloToolIT, using Spring Boot's @SpringBootTest and MockMvc to send JSON-RPC 2.0 requests to the /mcp endpoint. It verifies that the prompt can be retrieved with the correct name review-code and that the response contains the expected prompt structure.

Review & Testing Checklist for Human

  • Verify prompt response structure: Manually send a prompts/get request to /mcp endpoint with the same payload to confirm the actual API response matches the test assertions (especially $.result.messages[0].role and $.result.messages[0].content.type)
  • Test with different parameters: Try the prompt with different language/code combinations to ensure the arguments are handled correctly
  • Check prompt name: Confirm that "review-code" is the correct prompt name by checking prompts/list endpoint
  • Validate JSON-RPC format: Ensure the prompts/get method uses the correct parameter structure compared to tools/call

Diagram

%%{ init : { "theme" : "default" }}%%
graph TB
    HelloToolIT["HelloToolIT.java<br/>(existing pattern)"]:::context
    CodeReviewPromptsIT["CodeReviewPromptsIT.java<br/>(new integration test)"]:::major-edit
    CodeReviewPrompts["CodeReviewPrompts.java<br/>(class under test)"]:::context
    McpEndpoint["/mcp endpoint<br/>(JSON-RPC API)"]:::context
    McpPromptsCapability["McpPromptsCapability.java<br/>(prompts/get handler)"]:::context
    
    HelloToolIT -.->|"pattern reference"| CodeReviewPromptsIT
    CodeReviewPromptsIT -->|"prompts/get request"| McpEndpoint
    McpEndpoint -->|"routes to"| McpPromptsCapability
    McpPromptsCapability -->|"invokes"| CodeReviewPrompts
    CodeReviewPrompts -->|"GetPromptResult"| McpPromptsCapability
    
    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit
        L3[Context/No Edit]:::context
    end
    
    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB
    classDef context fill:#FFFFFF
Loading

Notes

  • This establishes the first pattern for prompt integration testing in the codebase
  • Prompt name "review-code" was taken from the @Prompt annotation in the CodeReviewPrompts class
  • Test uses Python code as example input: def hello():\n print('Hello, world!')
  • Response structure assumptions were made based on the HelloToolIT pattern but may need verification
  • Session requested by James Carman (@jwcarman) - Link to Devin run: https://app.devin.ai/sessions/6c2b42d5aa2c481c90e9de1f0a58035a

- Test code review prompt generation via MCP prompts/get endpoint
- Verify JSON-RPC 2.0 response format and prompt structure
- Follow existing HelloToolIT pattern

Co-Authored-By: James Carman <[email protected]>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@jwcarman
Copy link
Contributor

Perhaps we could add in some assertions to verify that the prompt text comes back?

- Assert that prompt contains expected template text
- Verify that the input code snippet is included in the prompt
- Address PR feedback from @jwcarman

Co-Authored-By: James Carman <[email protected]>
@sonarqubecloud
Copy link

@jwcarman jwcarman merged commit d14cea0 into main Jul 11, 2025
2 checks passed
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.

2 participants