hanyuzheng7 commented on code in PR #14570:
URL: https://github.com/apache/kafka/pull/14570#discussion_r1399652671


##########
streams/src/test/java/org/apache/kafka/streams/integration/IQv2StoreIntegrationTest.java:
##########
@@ -1584,7 +1646,43 @@ public <V> void shouldHandleKeyQuery(
         );
 
         final V result1 = queryResult.getResult();
-        final Integer integer = valueExtactor.apply(result1);
+        final Integer integer = (Integer) result1;
+        assertThat(integer, is(expectedValue));
+        assertThat(queryResult.getExecutionInfo(), is(empty()));
+        assertThat(queryResult.getPosition(), is(POSITION_0));
+    }
+
+    public <V> void shouldHandleTimestampedKeyQuery(
+            final Integer key,
+            final Integer expectedValue) {
+
+        final TimestampedKeyQuery<Integer, V> query = 
TimestampedKeyQuery.withKey(key);
+        final StateQueryRequest<ValueAndTimestamp<V>> request =
+                inStore(STORE_NAME)
+                        .withQuery(query)
+                        .withPartitions(mkSet(0, 1))
+                        .withPositionBound(PositionBound.at(INPUT_POSITION));
+
+        final StateQueryResult<ValueAndTimestamp<V>> result =
+                IntegrationTestUtils.iqv2WaitForResult(kafkaStreams, request);
+        final QueryResult<ValueAndTimestamp<V>> queryResult = 
result.getOnlyPartitionResult();
+        if (queryResult == null) {
+            throw new AssertionError("cannot use this query type to query 
result");
+        }
+        final boolean failure = queryResult.isFailure();
+        if (failure) {
+            throw new AssertionError(queryResult.toString());
+        }
+        assertThat(queryResult.isSuccess(), is(true));
+
+        assertThrows(IllegalArgumentException.class, 
queryResult::getFailureReason);
+        assertThrows(
+                IllegalArgumentException.class,
+                queryResult::getFailureMessage
+        );
+
+        final ValueAndTimestamp<V> result1 = queryResult.getResult();

Review Comment:
   ok



##########
streams/src/test/java/org/apache/kafka/streams/integration/IQv2StoreIntegrationTest.java:
##########
@@ -1584,7 +1646,43 @@ public <V> void shouldHandleKeyQuery(
         );
 
         final V result1 = queryResult.getResult();
-        final Integer integer = valueExtactor.apply(result1);
+        final Integer integer = (Integer) result1;
+        assertThat(integer, is(expectedValue));
+        assertThat(queryResult.getExecutionInfo(), is(empty()));
+        assertThat(queryResult.getPosition(), is(POSITION_0));
+    }
+
+    public <V> void shouldHandleTimestampedKeyQuery(
+            final Integer key,
+            final Integer expectedValue) {
+
+        final TimestampedKeyQuery<Integer, V> query = 
TimestampedKeyQuery.withKey(key);
+        final StateQueryRequest<ValueAndTimestamp<V>> request =
+                inStore(STORE_NAME)
+                        .withQuery(query)
+                        .withPartitions(mkSet(0, 1))
+                        .withPositionBound(PositionBound.at(INPUT_POSITION));
+
+        final StateQueryResult<ValueAndTimestamp<V>> result =
+                IntegrationTestUtils.iqv2WaitForResult(kafkaStreams, request);
+        final QueryResult<ValueAndTimestamp<V>> queryResult = 
result.getOnlyPartitionResult();
+        if (queryResult == null) {
+            throw new AssertionError("cannot use this query type to query 
result");
+        }
+        final boolean failure = queryResult.isFailure();
+        if (failure) {
+            throw new AssertionError(queryResult.toString());
+        }
+        assertThat(queryResult.isSuccess(), is(true));
+
+        assertThrows(IllegalArgumentException.class, 
queryResult::getFailureReason);
+        assertThrows(
+                IllegalArgumentException.class,
+                queryResult::getFailureMessage
+        );
+
+        final ValueAndTimestamp<V> result1 = queryResult.getResult();
+        final Integer integer = (Integer) result1.value();
         assertThat(integer, is(expectedValue));

Review Comment:
   ok



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to