You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "clolov (via GitHub)" <gi...@apache.org> on 2023/08/16 10:49:50 UTC

[GitHub] [kafka] clolov opened a new pull request, #14222: KAFKA-14133: Move RocksDBRangeIteratorTest, TimestampedKeyValueStoreBuilderTest and TimestampedSegmentTest to Mockito

clolov opened a new pull request, #14222:
URL: https://github.com/apache/kafka/pull/14222

   This pull requests migrates mocks from RocksDBRangeIteratorTest, TimestampedKeyValueStoreBuilderTest and TimestampedSegmentTest to Mockito.


-- 
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-unsubscribe@kafka.apache.org

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


[GitHub] [kafka] divijvaidya commented on pull request #14222: KAFKA-14133: Move RocksDBRangeIteratorTest, TimestampedKeyValueStoreBuilderTest and TimestampedSegmentTest to Mockito

Posted by "divijvaidya (via GitHub)" <gi...@apache.org>.
divijvaidya commented on PR #14222:
URL: https://github.com/apache/kafka/pull/14222#issuecomment-1697374505

   Restarting the build again since last one failed with problems in apache infra


-- 
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-unsubscribe@kafka.apache.org

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


[GitHub] [kafka] clolov commented on a diff in pull request #14222: KAFKA-14133: Move RocksDBRangeIteratorTest, TimestampedKeyValueStoreBuilderTest and TimestampedSegmentTest to Mockito

Posted by "clolov (via GitHub)" <gi...@apache.org>.
clolov commented on code in PR #14222:
URL: https://github.com/apache/kafka/pull/14222#discussion_r1304087260


##########
streams/src/test/java/org/apache/kafka/streams/state/internals/TimestampedKeyValueStoreBuilderTest.java:
##########
@@ -155,42 +144,24 @@ public void shouldThrowNullPointerIfInnerIsNull() {
 
     @Test
     public void shouldNotThrowNullPointerIfKeySerdeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         // does not throw
         new TimestampedKeyValueStoreBuilder<>(supplier, null, Serdes.String(), new MockTime());
     }
 
     @Test
     public void shouldNotThrowNullPointerIfValueSerdeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         // does not throw
         new TimestampedKeyValueStoreBuilder<>(supplier, Serdes.String(), null, new MockTime());
     }
 
     @Test
     public void shouldThrowNullPointerIfTimeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         assertThrows(NullPointerException.class, () -> new TimestampedKeyValueStoreBuilder<>(supplier, Serdes.String(), Serdes.String(), null));
     }
 
     @Test
     public void shouldThrowNullPointerIfMetricsScopeIsNull() {
-        reset(supplier);
-        expect(supplier.get()).andReturn(new RocksDBTimestampedStore("name", null));
-        expect(supplier.name()).andReturn("name");

Review Comment:
   ## Line 192
   Line 192 is part of the setup - https://github.com/apache/kafka/pull/14222/files#diff-5d8f05341b748d36ea99e0ce541ca3ff0a4ac0a6d35a2e2ad0ffb383202b1201R52
   
   ## Line 191
   The builder's code is
   ```
       public TimestampedKeyValueStoreBuilder(final KeyValueBytesStoreSupplier storeSupplier,
                                              final Serde<K> keySerde,
                                              final Serde<V> valueSerde,
                                              final Time time) {
           super(
               storeSupplier.name(),
               keySerde,
               valueSerde == null ? null : new ValueAndTimestampSerde<>(valueSerde),
               time);
           Objects.requireNonNull(storeSupplier, "storeSupplier can't be null");
           Objects.requireNonNull(storeSupplier.metricsScope(), "storeSupplier's metricsScope can't be null");
           
           ^-- THIS IS THE LINE WHICH WE ARE TRYING TO TEST !!!
   
           this.storeSupplier = storeSupplier;
       }
   ```
   It does not use the supplier.get() method on the test path



-- 
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-unsubscribe@kafka.apache.org

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


[GitHub] [kafka] divijvaidya commented on a diff in pull request #14222: KAFKA-14133: Move RocksDBRangeIteratorTest, TimestampedKeyValueStoreBuilderTest and TimestampedSegmentTest to Mockito

Posted by "divijvaidya (via GitHub)" <gi...@apache.org>.
divijvaidya commented on code in PR #14222:
URL: https://github.com/apache/kafka/pull/14222#discussion_r1307205079


##########
streams/src/test/java/org/apache/kafka/streams/state/internals/TimestampedKeyValueStoreBuilderTest.java:
##########
@@ -155,42 +144,24 @@ public void shouldThrowNullPointerIfInnerIsNull() {
 
     @Test
     public void shouldNotThrowNullPointerIfKeySerdeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         // does not throw
         new TimestampedKeyValueStoreBuilder<>(supplier, null, Serdes.String(), new MockTime());
     }
 
     @Test
     public void shouldNotThrowNullPointerIfValueSerdeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         // does not throw
         new TimestampedKeyValueStoreBuilder<>(supplier, Serdes.String(), null, new MockTime());
     }
 
     @Test
     public void shouldThrowNullPointerIfTimeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         assertThrows(NullPointerException.class, () -> new TimestampedKeyValueStoreBuilder<>(supplier, Serdes.String(), Serdes.String(), null));
     }
 
     @Test
     public void shouldThrowNullPointerIfMetricsScopeIsNull() {
-        reset(supplier);
-        expect(supplier.get()).andReturn(new RocksDBTimestampedStore("name", null));
-        expect(supplier.name()).andReturn("name");

Review Comment:
   makes sense. Thank you.



-- 
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-unsubscribe@kafka.apache.org

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


[GitHub] [kafka] divijvaidya commented on pull request #14222: KAFKA-14133: Move RocksDBRangeIteratorTest, TimestampedKeyValueStoreBuilderTest and TimestampedSegmentTest to Mockito

Posted by "divijvaidya (via GitHub)" <gi...@apache.org>.
divijvaidya commented on PR #14222:
URL: https://github.com/apache/kafka/pull/14222#issuecomment-1698803492

   All test failures unrelated to the tests which are modified in this PR.
   ```
   [Build / JDK 20 and Scala 2.13 / kafka.server.DynamicBrokerReconfigurationTest.testThreadPoolResize()](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/kafka.server/DynamicBrokerReconfigurationTest/Build___JDK_20_and_Scala_2_13___testThreadPoolResize__/)
   [Build / JDK 20 and Scala 2.13 / org.apache.kafka.tiered.storage.integration.OffloadAndConsumeFromLeaderTest.initializationError](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/org.apache.kafka.tiered.storage.integration/OffloadAndConsumeFromLeaderTest/Build___JDK_20_and_Scala_2_13___initializationError/)
   [Build / JDK 8 and Scala 2.12 / org.apache.kafka.connect.mirror.integration.MirrorConnectorsIntegrationSSLTest.testReplicateSourceDefault()](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/org.apache.kafka.connect.mirror.integration/MirrorConnectorsIntegrationSSLTest/Build___JDK_8_and_Scala_2_12___testReplicateSourceDefault__/)
   [Build / JDK 8 and Scala 2.12 / kafka.server.DynamicBrokerReconfigurationTest.testThreadPoolResize()](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/kafka.server/DynamicBrokerReconfigurationTest/Build___JDK_8_and_Scala_2_12___testThreadPoolResize__/)
   [Build / JDK 8 and Scala 2.12 / org.apache.kafka.controller.QuorumControllerMetricsIntegrationTest.testEventQueueOperationsStartedMetric()](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/org.apache.kafka.controller/QuorumControllerMetricsIntegrationTest/Build___JDK_8_and_Scala_2_12___testEventQueueOperationsStartedMetric__/)
   [Build / JDK 8 and Scala 2.12 / org.apache.kafka.controller.QuorumControllerTest.testBalancePartitionLeaders()](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/org.apache.kafka.controller/QuorumControllerTest/Build___JDK_8_and_Scala_2_12___testBalancePartitionLeaders__/)
   [Build / JDK 8 and Scala 2.12 / org.apache.kafka.tiered.storage.integration.OffloadAndConsumeFromLeaderTest.initializationError](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/org.apache.kafka.tiered.storage.integration/OffloadAndConsumeFromLeaderTest/Build___JDK_8_and_Scala_2_12___initializationError/)
   [Build / JDK 17 and Scala 2.13 / kafka.server.DynamicBrokerReconfigurationTest.testThreadPoolResize()](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/kafka.server/DynamicBrokerReconfigurationTest/Build___JDK_17_and_Scala_2_13___testThreadPoolResize__/)
   [Build / JDK 17 and Scala 2.13 / org.apache.kafka.controller.QuorumControllerTest.testBalancePartitionLeaders()](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/org.apache.kafka.controller/QuorumControllerTest/Build___JDK_17_and_Scala_2_13___testBalancePartitionLeaders__/)
   [Build / JDK 17 and Scala 2.13 / org.apache.kafka.tiered.storage.integration.OffloadAndConsumeFromLeaderTest.initializationError](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/org.apache.kafka.tiered.storage.integration/OffloadAndConsumeFromLeaderTest/Build___JDK_17_and_Scala_2_13___initializationError/)
   [Build / JDK 17 and Scala 2.13 / org.apache.kafka.trogdor.coordinator.CoordinatorTest.testTaskRequestWithOldStartMsGetsUpdated()](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/org.apache.kafka.trogdor.coordinator/CoordinatorTest/Build___JDK_17_and_Scala_2_13___testTaskRequestWithOldStartMsGetsUpdated__/)
   [Build / JDK 11 and Scala 2.13 / org.apache.kafka.common.network.SslTransportLayerTest.[2] tlsProtocol=TLSv1.2, useInlinePem=true](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/org.apache.kafka.common.network/SslTransportLayerTest/Build___JDK_11_and_Scala_2_13____2__tlsProtocol_TLSv1_2__useInlinePem_true/)
   [Build / JDK 11 and Scala 2.13 / kafka.server.DynamicBrokerReconfigurationTest.testThreadPoolResize()](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/kafka.server/DynamicBrokerReconfigurationTest/Build___JDK_11_and_Scala_2_13___testThreadPoolResize__/)
   [Build / JDK 11 and Scala 2.13 / org.apache.kafka.controller.QuorumControllerTest.testBalancePartitionLeaders()](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/org.apache.kafka.controller/QuorumControllerTest/Build___JDK_11_and_Scala_2_13___testBalancePartitionLeaders__/)
   [Build / JDK 11 and Scala 2.13 / org.apache.kafka.controller.QuorumControllerTest.testDelayedConfigurationOperations()](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/org.apache.kafka.controller/QuorumControllerTest/Build___JDK_11_and_Scala_2_13___testDelayedConfigurationOperations__/)
   [Build / JDK 11 and Scala 2.13 / org.apache.kafka.tiered.storage.integration.OffloadAndConsumeFromLeaderTest.initializationError](https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/junit/org.apache.kafka.tiered.storage.integration/OffloadAndConsumeFromLeaderTest/Build___JDK_11_and_Scala_2_13___initializationError/)
   ```
   
   The tests which are modified are successful - https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-14222/4/testReport/org.apache.kafka.streams.state.internals/


-- 
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-unsubscribe@kafka.apache.org

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


[GitHub] [kafka] clolov commented on a diff in pull request #14222: KAFKA-14133: Move RocksDBRangeIteratorTest, TimestampedKeyValueStoreBuilderTest and TimestampedSegmentTest to Mockito

Posted by "clolov (via GitHub)" <gi...@apache.org>.
clolov commented on code in PR #14222:
URL: https://github.com/apache/kafka/pull/14222#discussion_r1304087260


##########
streams/src/test/java/org/apache/kafka/streams/state/internals/TimestampedKeyValueStoreBuilderTest.java:
##########
@@ -155,42 +144,24 @@ public void shouldThrowNullPointerIfInnerIsNull() {
 
     @Test
     public void shouldNotThrowNullPointerIfKeySerdeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         // does not throw
         new TimestampedKeyValueStoreBuilder<>(supplier, null, Serdes.String(), new MockTime());
     }
 
     @Test
     public void shouldNotThrowNullPointerIfValueSerdeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         // does not throw
         new TimestampedKeyValueStoreBuilder<>(supplier, Serdes.String(), null, new MockTime());
     }
 
     @Test
     public void shouldThrowNullPointerIfTimeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         assertThrows(NullPointerException.class, () -> new TimestampedKeyValueStoreBuilder<>(supplier, Serdes.String(), Serdes.String(), null));
     }
 
     @Test
     public void shouldThrowNullPointerIfMetricsScopeIsNull() {
-        reset(supplier);
-        expect(supplier.get()).andReturn(new RocksDBTimestampedStore("name", null));
-        expect(supplier.name()).andReturn("name");

Review Comment:
   ## Line 192
   Line 192 is part of the setup - https://github.com/apache/kafka/pull/14222/files#diff-5d8f05341b748d36ea99e0ce541ca3ff0a4ac0a6d35a2e2ad0ffb383202b1201R52
   
   ## Line 191
   The builder's code is
   ```
       public TimestampedKeyValueStoreBuilder(final KeyValueBytesStoreSupplier storeSupplier,
                                              final Serde<K> keySerde,
                                              final Serde<V> valueSerde,
                                              final Time time) {
           super(
               storeSupplier.name(),
               keySerde,
               valueSerde == null ? null : new ValueAndTimestampSerde<>(valueSerde),
               time);
           Objects.requireNonNull(storeSupplier, "storeSupplier can't be null");
           Objects.requireNonNull(storeSupplier.metricsScope(), "storeSupplier's metricsScope can't be null");
           ^-- THIS IS THE LINE WHICH WE ARE TRYING TO TEST !!!
           this.storeSupplier = storeSupplier;
       }
   ```
   It does not use the supplier.get() method on the test path



-- 
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-unsubscribe@kafka.apache.org

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


[GitHub] [kafka] divijvaidya commented on a diff in pull request #14222: KAFKA-14133: Move RocksDBRangeIteratorTest, TimestampedKeyValueStoreBuilderTest and TimestampedSegmentTest to Mockito

Posted by "divijvaidya (via GitHub)" <gi...@apache.org>.
divijvaidya commented on code in PR #14222:
URL: https://github.com/apache/kafka/pull/14222#discussion_r1302664682


##########
streams/src/test/java/org/apache/kafka/streams/state/internals/TimestampedKeyValueStoreBuilderTest.java:
##########
@@ -155,42 +144,24 @@ public void shouldThrowNullPointerIfInnerIsNull() {
 
     @Test
     public void shouldNotThrowNullPointerIfKeySerdeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         // does not throw
         new TimestampedKeyValueStoreBuilder<>(supplier, null, Serdes.String(), new MockTime());
     }
 
     @Test
     public void shouldNotThrowNullPointerIfValueSerdeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         // does not throw
         new TimestampedKeyValueStoreBuilder<>(supplier, Serdes.String(), null, new MockTime());
     }
 
     @Test
     public void shouldThrowNullPointerIfTimeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         assertThrows(NullPointerException.class, () -> new TimestampedKeyValueStoreBuilder<>(supplier, Serdes.String(), Serdes.String(), null));
     }
 
     @Test
     public void shouldThrowNullPointerIfMetricsScopeIsNull() {
-        reset(supplier);
-        expect(supplier.get()).andReturn(new RocksDBTimestampedStore("name", null));
-        expect(supplier.name()).andReturn("name");

Review Comment:
   I assume that these are unused mocks? Could it be the case that they were expected to be used and as a bug in the main code they aren't being used? Have you verified this (I haven't looked at the code beyind this test during this review)?



-- 
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-unsubscribe@kafka.apache.org

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


[GitHub] [kafka] clolov commented on a diff in pull request #14222: KAFKA-14133: Move RocksDBRangeIteratorTest, TimestampedKeyValueStoreBuilderTest and TimestampedSegmentTest to Mockito

Posted by "clolov (via GitHub)" <gi...@apache.org>.
clolov commented on code in PR #14222:
URL: https://github.com/apache/kafka/pull/14222#discussion_r1304087260


##########
streams/src/test/java/org/apache/kafka/streams/state/internals/TimestampedKeyValueStoreBuilderTest.java:
##########
@@ -155,42 +144,24 @@ public void shouldThrowNullPointerIfInnerIsNull() {
 
     @Test
     public void shouldNotThrowNullPointerIfKeySerdeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         // does not throw
         new TimestampedKeyValueStoreBuilder<>(supplier, null, Serdes.String(), new MockTime());
     }
 
     @Test
     public void shouldNotThrowNullPointerIfValueSerdeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         // does not throw
         new TimestampedKeyValueStoreBuilder<>(supplier, Serdes.String(), null, new MockTime());
     }
 
     @Test
     public void shouldThrowNullPointerIfTimeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         assertThrows(NullPointerException.class, () -> new TimestampedKeyValueStoreBuilder<>(supplier, Serdes.String(), Serdes.String(), null));
     }
 
     @Test
     public void shouldThrowNullPointerIfMetricsScopeIsNull() {
-        reset(supplier);
-        expect(supplier.get()).andReturn(new RocksDBTimestampedStore("name", null));
-        expect(supplier.name()).andReturn("name");

Review Comment:
   ## Line 192
   Line 192 is part of the setup - https://github.com/apache/kafka/pull/14222/files#diff-5d8f05341b748d36ea99e0ce541ca3ff0a4ac0a6d35a2e2ad0ffb383202b1201R52
   
   ## Line 191
   The builder's code is
   ```
       public TimestampedKeyValueStoreBuilder(final KeyValueBytesStoreSupplier storeSupplier,
                                              final Serde<K> keySerde,
                                              final Serde<V> valueSerde,
                                              final Time time) {
           super(
               storeSupplier.name(),
               keySerde,
               valueSerde == null ? null : new ValueAndTimestampSerde<>(valueSerde),
               time);
           Objects.requireNonNull(storeSupplier, "storeSupplier can't be null");
           Objects.requireNonNull(storeSupplier.metricsScope(), "storeSupplier's metricsScope can't be null"); <- THIS IS THE LINE WHICH WE ARE TRYING TO TEST
           this.storeSupplier = storeSupplier;
       }
   ```
   It does not use the supplier.get() method on the test path



-- 
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-unsubscribe@kafka.apache.org

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


[GitHub] [kafka] clolov commented on a diff in pull request #14222: KAFKA-14133: Move RocksDBRangeIteratorTest, TimestampedKeyValueStoreBuilderTest and TimestampedSegmentTest to Mockito

Posted by "clolov (via GitHub)" <gi...@apache.org>.
clolov commented on code in PR #14222:
URL: https://github.com/apache/kafka/pull/14222#discussion_r1304087260


##########
streams/src/test/java/org/apache/kafka/streams/state/internals/TimestampedKeyValueStoreBuilderTest.java:
##########
@@ -155,42 +144,24 @@ public void shouldThrowNullPointerIfInnerIsNull() {
 
     @Test
     public void shouldNotThrowNullPointerIfKeySerdeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         // does not throw
         new TimestampedKeyValueStoreBuilder<>(supplier, null, Serdes.String(), new MockTime());
     }
 
     @Test
     public void shouldNotThrowNullPointerIfValueSerdeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         // does not throw
         new TimestampedKeyValueStoreBuilder<>(supplier, Serdes.String(), null, new MockTime());
     }
 
     @Test
     public void shouldThrowNullPointerIfTimeIsNull() {
-        reset(supplier);
-        expect(supplier.name()).andReturn("name");
-        expect(supplier.metricsScope()).andReturn("metricScope").anyTimes();
-        replay(supplier);
-
         assertThrows(NullPointerException.class, () -> new TimestampedKeyValueStoreBuilder<>(supplier, Serdes.String(), Serdes.String(), null));
     }
 
     @Test
     public void shouldThrowNullPointerIfMetricsScopeIsNull() {
-        reset(supplier);
-        expect(supplier.get()).andReturn(new RocksDBTimestampedStore("name", null));
-        expect(supplier.name()).andReturn("name");

Review Comment:
   Line 192 is part of the setup - https://github.com/apache/kafka/pull/14222/files#diff-5d8f05341b748d36ea99e0ce541ca3ff0a4ac0a6d35a2e2ad0ffb383202b1201R52
   The builder's code is
   ```
       public TimestampedKeyValueStoreBuilder(final KeyValueBytesStoreSupplier storeSupplier,
                                              final Serde<K> keySerde,
                                              final Serde<V> valueSerde,
                                              final Time time) {
           super(
               storeSupplier.name(),
               keySerde,
               valueSerde == null ? null : new ValueAndTimestampSerde<>(valueSerde),
               time);
           Objects.requireNonNull(storeSupplier, "storeSupplier can't be null");
           Objects.requireNonNull(storeSupplier.metricsScope(), "storeSupplier's metricsScope can't be null"); <- THIS IS THE LINE WHICH WE ARE TRYING TO TEST
           this.storeSupplier = storeSupplier;
       }
   ```
   It does not use the supplier.get() method on the test path



-- 
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-unsubscribe@kafka.apache.org

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


[GitHub] [kafka] divijvaidya merged pull request #14222: KAFKA-14133: Move RocksDBRangeIteratorTest, TimestampedKeyValueStoreBuilderTest and TimestampedSegmentTest to Mockito

Posted by "divijvaidya (via GitHub)" <gi...@apache.org>.
divijvaidya merged PR #14222:
URL: https://github.com/apache/kafka/pull/14222


-- 
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-unsubscribe@kafka.apache.org

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