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

Add support populate Java Object with custom schema without FakeForSc… #787

Merged
merged 4 commits into from
Apr 30, 2023

Conversation

RVRhub
Copy link
Contributor

@RVRhub RVRhub commented Apr 23, 2023

PR adds support to populate Java objects with a custom schema without using the FakeForSchema annotation. The existing implementation of net.datafaker.providers.base.BaseFaker#populate(java.lang.Class<T>, net.datafaker.transformations.Schema<java.lang.Object,?>) requires the use FakeForSchema annotation to generate fake data for the object.

@what-the-diff
Copy link

what-the-diff bot commented Apr 23, 2023

PR Summary

  • Added a new method for custom schemas in FakeResolver class
    A new method has been added to the FakeResolver class to support generating data based on custom schemas.

  • Updated method signature and added new method in BaseFaker class
    The populate() method in the BaseFaker class has been updated with a simpler signature, and a new method has been added to support custom schemas.

  • Modified and added test cases in FakeAnnotationTest
    Test case name 'shouldGenerateEntityWithDefaultSchemaWhenNoAnnotationPresentInCurrentClass' has been changed and updated according to the changes made in the BaseFaker class. A new test case has been added to verify the generation of an entity using the default template without needing an annotation on the class definition.

@codecov-commenter
Copy link

Codecov Report

Merging #787 (cfe8aaa) into main (dc4cfcf) will increase coverage by 0.00%.
The diff coverage is 62.50%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff            @@
##               main     #787   +/-   ##
=========================================
  Coverage     92.86%   92.86%           
  Complexity     2642     2642           
=========================================
  Files           284      284           
  Lines          5212     5214    +2     
  Branches        537      536    -1     
=========================================
+ Hits           4840     4842    +2     
+ Misses          244      243    -1     
- Partials        128      129    +1     
Impacted Files Coverage Δ
...n/java/net/datafaker/annotations/FakeResolver.java 72.41% <50.00%> (-5.37%) ⬇️
...n/java/net/datafaker/providers/base/BaseFaker.java 90.59% <100.00%> (ø)

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@snuyanzin
Copy link
Collaborator

lgtm

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