-
Notifications
You must be signed in to change notification settings - Fork 59
How to Test Endpoints
Subhrodip Mohanta edited this page Apr 3, 2026
·
1 revision
Testing is a critical part of our development lifecycle. You can verify endpoints using several methods.
The easiest way to explore and test our APIs is via the built-in Swagger UI.
-
URL:
http://localhost:8080/swagger-ui/index.html - Features: Interactive documentation, request generation, and response visualization.
Most endpoints require a valid JWT token.
-
Authenticate: Send a POST request to
/authenticatewith your credentials. -
Copy Token: Copy the
jwtvalue from the response. -
Authorize: In Swagger UI, click the Authorize button and paste the token as
Bearer <your_token>. -
Request: Now you can call protected endpoints like
/usersor/posts.
We use Spring Boot Test for full-stack integration testing.
-
Location:
src/test/java/xyz/subho/clone/twitter/ -
Run Command:
./mvnw test
The test profile uses an in-memory H2 database, so no external setup is required for these tests.
Example of fetching posts with a token:
curl -X GET "http://localhost:8080/posts?page=0&size=10" \
-H "Authorization: Bearer <your_jwt_token>"