Skip to content

Refactor private constructor checker into a utility class #4133

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 1 commit into from
Jun 27, 2016

Conversation

akarnokd
Copy link
Member

Move into TestUtil.checkUtilityClass().

@akarnokd akarnokd added the Test label Jun 27, 2016
@codecov-io
Copy link

Current coverage is 81.25%

Merging #4133 into 1.x will decrease coverage by 0.04%

@@                1.x      #4133   diff @@
==========================================
  Files           257        257          
  Lines         16811      16811          
  Methods           0          0          
  Messages          0          0          
  Branches       2547       2547          
==========================================
- Hits          13666      13659     -7   
- Misses         2243       2245     +2   
- Partials        902        907     +5   

Powered by Codecov. Last updated by 5c74757...c568e9d

@vanniktech
Copy link
Collaborator

👍

/**
* Common test utility methods.
*/
public enum TestUtil {
Copy link

Choose a reason for hiding this comment

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

Just curious - why use an enum here instead of a class? Is it just to forbid inheritance?

Copy link
Member Author

Choose a reason for hiding this comment

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

Exactly - but not my invention. I saw this in the JDK source and in fact, saves you testing a private constructor. However, we can't expose such enums through the public API so only some internal tools are defined this way.

@akarnokd
Copy link
Member Author

/cc @davidmoten

@davidmoten
Copy link
Collaborator

👍

@akarnokd akarnokd merged commit 5439901 into ReactiveX:1.x Jun 27, 2016
@akarnokd akarnokd deleted the PrivateCheckerUtil branch June 27, 2016 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants