Add unit tests for all application modules (39 tests) by devin-ai-integration[bot] · Pull Request #3 · oneky/NewBingGoGo-MagicURL-java · GitHub
Skip to content

Add unit tests for all application modules (39 tests)#3

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1782311934-add-unit-tests
Open

Add unit tests for all application modules (39 tests)#3
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1782311934-add-unit-tests

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

The project had zero test coverage — no test directory or test dependencies existed. This PR adds a complete unit test suite covering all three application modules (NewBingGoGoServer, NewBingGoGoServerWebSocket, NewBingGoGoClientWebSocket).

Changes:

  • build.gradle: Added JUnit 5 + Mockito test dependencies and useJUnitPlatform() config
  • NewBingGoGoServerUtilTest (16 tests): Covers escapeJsonString (special char escaping edge cases), printErrorToString (stack trace formatting), isUser (user-agent detection), getIp (X-Forwarded-For parsing), getReturnError (JSON error response generation)
  • NewBingGoGoServerRouteTest (6 tests): Covers serveHttp routing (missing UA rejection, unknown URL fallback) and openWebSocket routing
  • NewBingGoGoClientWebSocketTest (11 tests): Covers message buffering on onOpen, message forwarding via onMessage, close code mapping in onClose, error handling in onError

All 39 tests pass locally via ./gradlew test.

Link to Devin session: https://app.devin.ai/sessions/c7adfa5d669a4d35b3a38e2d684f7b43
Requested by: @oneky

- Add JUnit 5 and Mockito test dependencies to build.gradle
- Add unit tests for utility methods: escapeJsonString, printErrorToString, isUser, getIp, getReturnError
- Add routing tests for serveHttp and openWebSocket
- Add unit tests for NewBingGoGoClientWebSocket message handling and lifecycle
- Total: 39 tests covering all application modules

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@oneky oneky self-assigned this Jun 24, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

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.

1 participant