Skip to content

Correct custom provider example #661

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

Merged
merged 2 commits into from
Jan 30, 2023
Merged

Correct custom provider example #661

merged 2 commits into from
Jan 30, 2023

Conversation

AlexJFerreira
Copy link
Contributor

@AlexJFerreira AlexJFerreira commented Jan 30, 2023

It's only possible to create a custom provider with BaseProviders instead of a Faker in it's constructor.

With Faker, it gets the following error: "reason: no instance(s) of type variable(s) exist so that BaseProviders conforms to Faker"

It's only possible to create a custom provider with BaseProviders instead of a Faker in it's constructor.
@what-the-diff
Copy link

what-the-diff bot commented Jan 30, 2023

  • The constructor of the Insect class was changed to accept a BaseProviders object instead of Faker.
  • A new method called getName() was added which returns an insect name from INSECT_NAMES array randomly using faker's random().nextInt(INSECT_NAMES.length) function call and then returning that element in the array at index returned by nextInt().

@AlexJFerreira AlexJFerreira changed the title Correct cutom provider example Correct custom provider example Jan 30, 2023
@snuyanzin
Copy link
Collaborator

thanks
i would suggest to fix the same issue with InsectFromFile in same doc

Correct custom provider constructor example
@AlexJFerreira
Copy link
Contributor Author

thanks i would suggest to fix the same issue with InsectFromFile in same doc

Yeah, well noted. It's done.

@codecov-commenter
Copy link

Codecov Report

Merging #661 (189c88b) into main (d9d1ba3) will decrease coverage by 0.02%.
The diff coverage is n/a.

📣 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     #661      +/-   ##
============================================
- Coverage     92.70%   92.68%   -0.02%     
- Complexity     2631     2632       +1     
============================================
  Files           283      283              
  Lines          5426     5426              
  Branches        589      589              
============================================
- Hits           5030     5029       -1     
- Misses          243      245       +2     
+ Partials        153      152       -1     
Impacted Files Coverage Δ
...ain/java/net/datafaker/idnumbers/EnZAIdNumber.java 83.33% <0.00%> (-8.34%) ⬇️
.../java/net/datafaker/service/FakeValuesService.java 84.95% <0.00%> (+0.59%) ⬆️

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

@bodiam
Copy link
Contributor

bodiam commented Jan 30, 2023

Thanks! Merged!

@bodiam bodiam merged commit 053e1e7 into datafaker-net:main Jan 30, 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.

4 participants