Skip to content

Conversation

Ketul3012
Copy link
Contributor

@Ketul3012 Ketul3012 commented Nov 6, 2023

I have added 3 test cases.

  1. Not allowed validator test case : There were no test cases covering this validation, so I have added that for test quality improvement.
  2. Invalid keyword in recursive reference validator: Exception case for recursive reference validator was not handled, so I created that.
  3. Empty array exception in prefixItems validator: There was no test case checking what happens if empty array is passed into prefixItems configuration, so I added that.

For code quality improvments

  1. Extracted method from isValidInet6Address to get valid and important from inet6Address for further processing.
  2. Renamed strict variable in DurationFormat.java to make it more understandable.
  3. Added explaining variable for return statement in TimeFormat.java.
  4. Extracted a class from BaseJsonValidator with methods concerning to validation messages.
  5. Removed unnecessary override in BaseJsonValidator to improve code readability.
  6. Moved version detection related methods from AbstractJsonSchemaTestSuite to SpecVersionDetector for better cohesion across methods

@Ketul3012
Copy link
Contributor Author

Ketul3012 commented Nov 9, 2023

@stevehu @prashanth-chaitanya @fdutton Can you please take a look at following test cases? these test cases improve coverage and make code more reliable Thanks.

@codecov-commenter
Copy link

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (b041fcc) 78.48% compared to head (6a40c35) 79.38%.
Report is 4 commits behind head on master.

Files Patch % Lines
...com/networknt/schema/ValidationMessageHandler.java 80.85% 4 Missing and 5 partials ⚠️
...n/java/com/networknt/schema/BaseJsonValidator.java 94.44% 0 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #890      +/-   ##
============================================
+ Coverage     78.48%   79.38%   +0.89%     
- Complexity     1213     1228      +15     
============================================
  Files           120      121       +1     
  Lines          3891     3905      +14     
  Branches        746      743       -3     
============================================
+ Hits           3054     3100      +46     
+ Misses          546      515      -31     
+ Partials        291      290       -1     

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

@stevehu stevehu merged commit 20a179f into networknt:master Nov 17, 2023
@stevehu
Copy link
Contributor

stevehu commented Nov 17, 2023

@Ketul3012 Thanks a lot for your help.

@Ketul3012 Ketul3012 changed the title Added test cases for not allowed validator, Handled invalid keyword test case for recurisve reference and empty array case for prefixItems validator Added test cases for not allowed validator, Handled invalid keyword test case for recurisve reference and empty array case for prefixItems validator, Performed refactoring for code improvments in InetAddressValidatorClass, DurationFormat, TimeFormat, BaseJsonValidator, AbstractSchemaTestSuite. Nov 17, 2023
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.

3 participants