Skip to content

Adding validation to Region class #261

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
Oct 26, 2017
Merged

Adding validation to Region class #261

merged 2 commits into from
Oct 26, 2017

Conversation

spfink
Copy link
Contributor

@spfink spfink commented Oct 25, 2017

At least adds some validation for #217

Description

Adds validation to Region.of(String value) to throw on null, empty or blank strings.

Motivation and Context

#217

Testing

Added additional test class.

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed
  • A short description of the change has been added to the CHANGELOG

License

  • I confirm that this pull request can be released under the Apache 2 license

@spfink spfink mentioned this pull request Oct 25, 2017
* @return The region associated with the provided name.
*/
public static Region of(String value) {
Validate.notBlank(value, "Region value can't be null, empty or blank.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this be better as Validate.paramNotBlank(value, "region");

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh - it doesn't exist - maybe it should

Copy link
Contributor Author

@spfink spfink Oct 26, 2017

Choose a reason for hiding this comment

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

What would paramNotBlank do that notBlank wouldn't?

@Test(expected = IllegalArgumentException.class)
public void of_ThrowsIllegalArgumentException_WhenBlankString() {
Region.of(" ");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Happy day test?

@spfink spfink force-pushed the finks/region-validation branch from 5f2c500 to c1338bb Compare October 26, 2017 17:34
@spfink spfink merged commit 77b8be4 into master Oct 26, 2017
@spfink spfink deleted the finks/region-validation branch October 26, 2017 19:24
shorea added a commit that referenced this pull request Aug 3, 2018
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