Skip to content

Conversation

@asolntsev
Copy link
Collaborator

fixes #1368

... when a custom faker has multiple methods with the same return type.
@asolntsev asolntsev self-assigned this Oct 4, 2024
@asolntsev asolntsev added the bug Something isn't working label Oct 4, 2024
@what-the-diff
Copy link

what-the-diff bot commented Oct 4, 2024

PR Summary

  • Enhanced Method Classification
    The scanMethodsByReturnType method, which collects methods based on what they return, has been improved. In scenarios where many methods return the same type, a consistent order is now ensured thanks to the chooseFirstByAlphabet function.

  • Introduction of Alphabet-based Selection
    A new function called chooseFirstByAlphabet has been added. This function decides which method comes first alphabetically, aiding in organizing methods with identical return types.

  • New Testing Case
    A fresh test case, multipleMethodsWithSameReturnType, has been implemented. This case tracks how methods are handled when they happen to share the same return type, with focus on the float type.

  • Expanded 'Person' Class Capability
    The Person class acquired two new methods - weight and width. These functions, returning float values of 90.0f and 60.0f respectively, further widen the functionality of the Person class.

@codecov
Copy link

codecov bot commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.42%. Comparing base (9015b0f) to head (1c95cde).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...va/net/datafaker/providers/base/ObjectMethods.java 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1369      +/-   ##
============================================
+ Coverage     92.40%   92.42%   +0.01%     
- Complexity     3146     3149       +3     
============================================
  Files           319      319              
  Lines          6177     6178       +1     
  Branches        604      604              
============================================
+ Hits           5708     5710       +2     
  Misses          327      327              
+ Partials        142      141       -1     

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

return 90.0f;
}
public float width() {
return 60.0f;
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's quite a belt size 🤪

@bodiam bodiam merged commit 41b5693 into main Oct 5, 2024
@bodiam bodiam deleted the fix/1368-fix-multiple-methods-with-same-return-types branch October 5, 2024 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate key error thrown when extending Faker class

3 participants