Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add dynamic path param support #1808

Conversation

KyrillosNageh
Copy link
Contributor

This update enhances the RequestBuilder class by introducing dynamic path parameter substitution. The solution includes:

  1. A method to handle single key-value pairs for setting path parameters dynamically.
  2. A method to handle multiple key-value pairs for scenarios involving complex endpoints.

@KyrillosNageh KyrillosNageh marked this pull request as draft November 18, 2024 10:14
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 6 lines in your changes missing coverage. Please review.

Project coverage is 52.48%. Comparing base (ce02a45) to head (1e4d450).
Report is 37 commits behind head on main.

Files with missing lines Patch % Lines
src/main/java/com/shaft/api/RequestBuilder.java 66.66% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1808      +/-   ##
============================================
- Coverage     53.24%   52.48%   -0.76%     
- Complexity     1355     1357       +2     
============================================
  Files           113      115       +2     
  Lines         10176    10359     +183     
  Branches        991     1000       +9     
============================================
+ Hits           5418     5437      +19     
- Misses         4117     4281     +164     
  Partials        641      641              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@MahmoudElSharkawy MahmoudElSharkawy left a comment

Choose a reason for hiding this comment

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

Great implementation!, please just check some small comments in the test class.

.setTargetStatusCode(200) // Expected status code
.perform(); // Execute the request

SHAFT.Report.log(">>>>>> Response Body:" + api.getResponseBody());
Copy link
Contributor

Choose a reason for hiding this comment

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

please add assertion to validate the response.

.setTargetStatusCode(200)
.perform();

SHAFT.Report.log(">>>>>> Response Body:" + api.getResponseBody());
Copy link
Contributor

Choose a reason for hiding this comment

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

please add assertion to validate the response.

.setTargetStatusCode(200)
.perform();

SHAFT.Report.log("Response Body: " + api.getResponseBody());
Copy link
Contributor

Choose a reason for hiding this comment

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

please add assertion to validate the response.

.setTargetStatusCode(200)
.perform();

api.assertThatResponse().body().contains("\"username\":\"string\"");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
api.assertThatResponse().body().contains("\"username\":\"string\"");
api.assertThatResponse().extractedJsonValue("username").isEqualTo("string");

.setTargetStatusCode(200)
.perform();

api.assertThatResponse().body().contains("\"username\":\"string\"");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
api.assertThatResponse().body().contains("\"username\":\"string\"");
api.assertThatResponse().extractedJsonValue("username").isEqualTo("string");

.setTargetStatusCode(200)
.perform();

api.assertThatResponse().body().contains("\"username\":\"string\"");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
api.assertThatResponse().body().contains("\"username\":\"string\"");
api.assertThatResponse().extractedJsonValue("username").isEqualTo("string");

@MahmoudElSharkawy MahmoudElSharkawy marked this pull request as ready for review December 12, 2024 13:56
@MahmoudElSharkawy MahmoudElSharkawy merged commit 3a16f2d into ShaftHQ:main Dec 12, 2024
16 of 17 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