-
Notifications
You must be signed in to change notification settings - Fork 327
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
Migrating datastore tests to JUnit5 #1031
Conversation
}; | ||
new Object[]{ | ||
"BUY", "abcd", | ||
// this int param requires custom conversion |
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.
Could you put formatting back for this one statement? Otherwise it's unclear what number this comment refers to.
void unSupportedOrTest() { | ||
|
||
assertThatThrownBy(() -> queryWithMockResult("countByTraderIdOrPrice", null, getClass().getMethod("traderAndPrice"))) | ||
.hasMessage("Cloud Datastore only supports multiple filters combined with AND."); | ||
|
||
queryWithMockResult("countByTraderIdOrPrice", null, getClass().getMethod("traderAndPrice")); | ||
|
||
// this.partTreeDatastoreQuery = createQuery(); | ||
this.partTreeDatastoreQuery.execute(new Object[] {123L, 45L}); | ||
//this.partTreeDatastoreQuery.execute(new Object[] {123L, 45L}); |
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 test was unfortunately structured in the first place with mock setup faling. Could you remove the commented-out lines, and add a comment to this test saying that "PartTreeDatastoreQuery constructor will fail as part of queryWithMockResult setup"?
The commented out line that was there in the first place shows why it was done this way -- getting all the setup in place before calling the constructor was too hard. This is commonly a sign that code under test has a structure that does not lend itself to testing.
Kudos, SonarCloud Quality Gate passed!
|
The reason checkstyle complains about the file name not matching the top-level public class name is a minor false-positive error with checkstyle. It sees that there is an interface above the no-longer-public classname, and assumes the file name should match the interface name instead. If you move the interface from being above the class to being below the class, you'll be able to remove the If this was an important false-positive, we'd file an issue with checkstyle. But putting a repository interface first, above the class that's the main point of this file, was an odd choice anyway, so it's better to fix it in our repo. |
* Migrating tests to JUnit5 * fixing code smell issues * Fixing
Tests Migrated: