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

feat: Check validator subclasses are annotated with @GtfsValidator #1263

Conversation

bdferris-v2
Copy link
Collaborator

Closes #1262

Add a unit-test that checks that any subclass of SingleEntityValidator or FileValidator is also annotated with @GtfsValidator.

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with gradle test to make sure you didn't break anything
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues

@isabelle-dr isabelle-dr modified the milestone: v4.0 Oct 4, 2022
Copy link
Collaborator

@asvechnikov2 asvechnikov2 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

+ ": "
+ validatorBaseClass.getSimpleName()
+ " validator subclass should be annotated with @GtfsValidator")
.that(annotationInfo != null)
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can probably use
.that(annotationInfo).isNotNull();

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I originally wrote it this way, but the resulting error message from Truth isn't particular helpful / readable in the context of this check. With the isTrue() check, we get something like:

SometValidator: FileValidator validator subclass should be annotated with @GtfsValidator
expected to be true

With the alternate syntax, we get:

SometValidator: FileValidator validator subclass should be annotated with @GtfsValidator
expected not to be: null

I think the former is more understandable than the latter.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks!

@bdferris-v2
Copy link
Collaborator Author

@asvechnikov2 I think we got the permissions fixed, but you'll need to LGTM again

+ ": "
+ validatorBaseClass.getSimpleName()
+ " validator subclass should be annotated with @GtfsValidator")
.that(annotationInfo != null)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks!

@bdferris-v2 bdferris-v2 merged commit d6278d3 into MobilityData:master Oct 7, 2022
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.

Add unit-test to ensure all validator subclasses are annotated with @GtfsValidator
3 participants