Skip to content

Add Unit and Integration Tests #2

Description

@thughari

What to do

  • Add unit tests and *integration tests for services, controllers, and repositories.
  • Use JUnit, Mockito, or any other testing framework/tool of your choice.
  • Follow the existing structure: com.thughari.randomchat.

Goal

Improve code quality and make RandomChat more robust.

Activity

  1. AbdulmalikAlayande commented on Oct 6, 2025

    @AbdulmalikAlayande

    Hi @thughari

    I forked the repository and cloned my fork, and I went through the java codes, I didn't find any service or repos, but I found some endpoints in the controllers, do those endpoints need testing?

    Also about the services and repos, are they available, so I can start writing tests for them

  2. thughari commented on Oct 6, 2025

    @thughari
    OwnerAuthor

    Hi @AbdulmalikAlayande

    Thanks for checking the code!
    You're right, the project doesn't have any service or repository layer since it doesn't persist data.

    For now, the main focus can be on writing tests for the existing controller and handler endpoints, as well as testing the WebSocket configuration.

  3. AnshulBytes112 commented on Oct 22, 2025

    @AnshulBytes112

    Hi @thughari ,

    I’d like to work on adding unit and integration tests to improve the code quality and robustness of RandomChat.

    Since the project doesn’t currently have a service or repository layer, my focus will be on testing the existing controller and WebSocket handler endpoints. I’ll use JUnit 5 and Mockito (along with Spring Boot’s testing support) to write:

    Unit tests for controller and WebSocket message handling logic.

    Integration tests using MockMvc or WebSocket test clients to ensure the endpoints and configurations behave correctly in the Spring context.

    These tests will help validate message routing, connection handling, and overall stability of the real-time chat flow.

    If this approach looks good, I’ll start implementing the tests under
    src/test/java/com/thughari/randomchat/ and open a PR once it’s ready.

  4. thughari commented on Oct 22, 2025

    @thughari
    OwnerAuthor

    Hi @AnshulBytes112

    That sounds like an excellent plan! I appreciate your initiative to improve the code quality and coverage with unit and integration tests.

    Please go ahead and start implementing the tests. When you’re done, make sure to open your PR to the dev branch for review.

    Looking forward to your PR!

    Thanks for contributing to RandomChat 🙌

  5. AnshulBytes112 commented on Oct 22, 2025

    @AnshulBytes112

    hey @thughari thanks for the follow up and I just want to tell you that i would raise few separate PR and not at once as the solution is vast and requires proper effort on each part
    I hope you understand this thanks!!

  6. thughari commented on Oct 22, 2025

    @thughari
    OwnerAuthor

    Thanks @AnshulBytes112 Sounds good!please proceed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions