-
Notifications
You must be signed in to change notification settings - Fork 24
Add strict kind validation to event classes #234
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
Add strict kind validation to event classes #234
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds strict kind validation to concrete event implementations to ensure each event class validates that its kind field matches the expected Kind enum value.
- Adds
validateKind()
method overrides to all concrete event classes - Adds a test to verify validation fails when kind values are mismatched
- Updates README to document the new validation behavior
Reviewed Changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 10 comments.
File | Description |
---|---|
ValidateKindTest.java | New test verifying AssertionError is thrown for mismatched kind values |
Various event classes | Added validateKind() method overrides to enforce expected Kind enum values |
README.md | Added documentation about the new event validation behavior |
@@ -32,4 +33,11 @@ public PaymentShipmentStatus getPaymentShipmentStatus() { | |||
protected PaymentShipmentStatus getEntity() { | |||
return getPaymentShipmentStatus(); | |||
} | |||
|
|||
@Override | |||
public void validateKind() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be protected
to match the pattern used in all other event classes. The public access modifier is inconsistent with the rest of the codebase.
public void validateKind() { | |
protected void validateKind() { |
Copilot uses AI. Check for mistakes.
@@ -32,4 +33,11 @@ public PaymentRequest getPaymentRequest() { | |||
protected PaymentRequest getEntity() { | |||
return getPaymentRequest(); | |||
} | |||
|
|||
@Override | |||
public void validateKind() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be protected
to match the pattern used in all other event classes. The public access modifier is inconsistent with the rest of the codebase.
public void validateKind() { | |
protected void validateKind() { |
Copilot uses AI. Check for mistakes.
@@ -35,4 +36,11 @@ public CustomerOrder getCustomerOrder() { | |||
protected CustomerOrder getEntity() { | |||
return getCustomerOrder(); | |||
} | |||
|
|||
@Override | |||
public void validateKind() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be protected
to match the pattern used in all other event classes. The public access modifier is inconsistent with the rest of the codebase.
public void validateKind() { | |
protected void validateKind() { |
Copilot uses AI. Check for mistakes.
@@ -39,6 +39,12 @@ protected Stall getEntity() { | |||
} | |||
|
|||
@Override | |||
public void validateKind() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be protected
to match the pattern used in all other event classes. The public access modifier is inconsistent with the rest of the codebase.
public void validateKind() { | |
protected void validateKind() { |
Copilot uses AI. Check for mistakes.
@@ -32,6 +33,12 @@ protected Product getEntity() { | |||
} | |||
|
|||
@Override | |||
public void validateKind() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be protected
to match the pattern used in all other event classes. The public access modifier is inconsistent with the rest of the codebase.
public void validateKind() { | |
protected void validateKind() { |
Copilot uses AI. Check for mistakes.
@@ -54,4 +54,11 @@ protected void validateTags() { | |||
throw new AssertionError("Missing or invalid `relay` tag."); | |||
} | |||
} | |||
|
|||
@Override | |||
public void validateKind() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be protected
to match the pattern used in all other event classes. The public access modifier is inconsistent with the rest of the codebase.
public void validateKind() { | |
protected void validateKind() { |
Copilot uses AI. Check for mistakes.
@@ -60,4 +60,11 @@ protected CalendarContent<T> getCalendarContent() { | |||
|
|||
return calendarContent; | |||
} | |||
|
|||
@Override | |||
public void validateKind() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be protected
to match the pattern used in all other event classes. The public access modifier is inconsistent with the rest of the codebase.
public void validateKind() { | |
protected void validateKind() { |
Copilot uses AI. Check for mistakes.
@@ -97,4 +97,11 @@ protected CalendarRsvpContent getCalendarContent() { | |||
|
|||
return calendarRsvpContent; | |||
} | |||
|
|||
@Override | |||
public void validateKind() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be protected
to match the pattern used in all other event classes. The public access modifier is inconsistent with the rest of the codebase.
public void validateKind() { | |
protected void validateKind() { |
Copilot uses AI. Check for mistakes.
@@ -81,4 +81,11 @@ protected void validateTags() { | |||
throw new AssertionError("Missing `title` tag for the event title."); | |||
} | |||
} | |||
|
|||
@Override | |||
public void validateKind() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be protected
to match the pattern used in all other event classes. The public access modifier is inconsistent with the rest of the codebase.
public void validateKind() { | |
protected void validateKind() { |
Copilot uses AI. Check for mistakes.
@@ -98,4 +98,11 @@ protected CalendarContent<T> getCalendarContent() { | |||
|
|||
return calendarContent; | |||
} | |||
|
|||
@Override | |||
public void validateKind() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be protected
to match the pattern used in all other event classes. The public access modifier is inconsistent with the rest of the codebase.
public void validateKind() { | |
protected void validateKind() { |
Copilot uses AI. Check for mistakes.
Summary
Testing
mvn -q verify
https://chatgpt.com/codex/tasks/task_b_688a84fdfbb083318d79b9337c990fcb