-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix: fix test for KIP-307 final PR #3402
Conversation
@@ -174,7 +174,7 @@ public void init() { | |||
|
|||
when(aggregateSchema.value()).thenReturn(mock(List.class)); | |||
|
|||
when(mockKGroupedTable.aggregate(any(), any(), any(), any())).thenReturn(table); | |||
when(mockKGroupedTable.aggregate(any(), any(), any(), (Materialized)any())).thenReturn(table); |
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.
Would be cleaner to do any(Materialized.class)
.
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.
Ack. I updated one instance of (Materialized)any()
to any(Materialized.class)
on line 314.
But changing this line to use any(Materialized.class)
caused NullPointerException
s in the test.
The reason for this from what I can see is that this function returns null
instead of a Materialized
instance in the test:
https://github.com/confluentinc/ksql/blob/master/ksql-engine/src/main/java/io/confluent/ksql/structured/SchemaKGroupedTable.java#L154-L158
By changing the mock to expect a Materialized.class
explicitly I think the mock returns null
instead of the KTable
instance when this is called ( https://github.com/confluentinc/ksql/blob/master/ksql-engine/src/main/java/io/confluent/ksql/structured/SchemaKGroupedTable.java#L160-L164)
I'm thinking this is ok as is or we could add something like when(materializedFactory.create(any(), any(), any())).thenReturn(materialized);
in the init()
method. WDYT?
@rodesai updated per comments |
3d9db48
to
4956c5e
Compare
Rebased and updated for additional test |
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.
LGTM
Description
The fifth and final PR for KIP-307 is getting merged today. This PR adds the following overload
KGoupedTable.aggregate(Initializer, Aggregator, Aggregator, Named
).This causes an error with the
SchemaKGroupedTableTest
when executingmockKGroupedTable.aggregate(any(), any(), any(), any()))
method. The compiler can't disambiguate the 4th argument, as it's either aMaterialized
or aNamed
object. This PR fixes the test.Update this PR build is passing now and can be merged once approved.
Testing done
I updated the test and ran the entire KSQL test suite, all tests passed.
Reviewer checklist