ijuma commented on a change in pull request #9520: URL: https://github.com/apache/kafka/pull/9520#discussion_r553369873
########## File path: core/src/test/scala/unit/kafka/zookeeper/ZooKeeperClientTest.scala ########## @@ -715,7 +711,7 @@ class ZooKeeperClientTest extends ZooKeeperTestHarness { private def cleanMetricsRegistry(): Unit = { val metrics = KafkaYammerMetrics.defaultRegistry - metrics.allMetrics.keySet.forEach(metrics.removeMetric) + metrics.allMetrics.keySet.forEach(m => metrics.removeMetric(m)) Review comment: Why did we change this? ########## File path: core/src/test/scala/integration/kafka/api/TransactionsTest.scala ########## @@ -407,46 +406,40 @@ class TransactionsTest extends KafkaServerTestHarness { TestUtils.waitUntilTrue(() => offsetAndMetadata.equals(consumer.committed(Set(tp).asJava).get(tp)), "cannot read committed offset") } - @Test(expected = classOf[TimeoutException]) + @Test def testInitTransactionsTimeout(): Unit = { testTimeout(false, producer => producer.initTransactions()) } - @Test(expected = classOf[TimeoutException]) + @Test def testSendOffsetsToTransactionTimeout(): Unit = { testTimeout(true, producer => producer.sendOffsetsToTransaction( Map(new TopicPartition(topic1, 0) -> new OffsetAndMetadata(0)).asJava, "test-group")) } - @Test(expected = classOf[TimeoutException]) + @Test def testCommitTransactionTimeout(): Unit = { testTimeout(true, producer => producer.commitTransaction()) } - @Test(expected = classOf[TimeoutException]) + @Test def testAbortTransactionTimeout(): Unit = { testTimeout(true, producer => producer.abortTransaction()) } - def testTimeout(needInitAndSendMsg: Boolean, + private def testTimeout(needInitAndSendMsg: Boolean, timeoutProcess: KafkaProducer[Array[Byte], Array[Byte]] => Unit): Unit = { - val producer = createTransactionalProducer("transactionProducer", maxBlockMs = 1000) - + val producer = createTransactionalProducer("transactionProducer", maxBlockMs = 3000) Review comment: Why did we increase maxBlockMs here? ########## File path: core/src/test/scala/unit/kafka/utils/QuotaUtilsTest.scala ########## @@ -17,24 +17,21 @@ package kafka.utils -import java.util.concurrent.TimeUnit - import org.apache.kafka.common.MetricName -import org.apache.kafka.common.metrics.{KafkaMetric, MetricConfig, Quota, QuotaViolationException} import org.apache.kafka.common.metrics.stats.{Rate, Value} - -import scala.jdk.CollectionConverters._ +import org.apache.kafka.common.metrics.{KafkaMetric, MetricConfig, Quota, QuotaViolationException} import org.junit.Assert._ import org.junit.Test -import org.scalatest.Assertions.assertThrows + +import java.util.concurrent.TimeUnit class QuotaUtilsTest { private val time = new MockTime private val numSamples = 10 private val sampleWindowSec = 1 private val maxThrottleTimeMs = 500 - private val metricName = new MetricName("test-metric", "groupA", "testA", Map.empty.asJava) + private val metricName = new MetricName("test-metric", "groupA", "testA", java.util.Collections.emptyMap()) Review comment: Why did you change this? ########## File path: streams/src/test/java/org/apache/kafka/streams/processor/internals/ProcessorNodeTest.java ########## @@ -49,18 +49,17 @@ public class ProcessorNodeTest { @SuppressWarnings("unchecked") - @Test(expected = StreamsException.class) + @Test public void shouldThrowStreamsExceptionIfExceptionCaughtDuringInit() { final ProcessorNode node = new ProcessorNode("name", new ExceptionalProcessor(), Collections.emptySet()); - node.init(null); + assertThrows(StreamsException.class, () -> node.init(null)); } @SuppressWarnings("unchecked") - @Test(expected = StreamsException.class) + @Test public void shouldThrowStreamsExceptionIfExceptionCaughtDuringClose() { final ProcessorNode node = new ProcessorNode("name", new ExceptionalProcessor(), Collections.emptySet()); - node.init(null); - node.close(); Review comment: Should we keep the `close`? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org