Browse Source

MINOR: Use JUnit-5 extension to enforce strict stubbing (#13347)

A privious change disabled strict stubbing for the `RocksDBMetricsRecorderTest`. To re-enable the behavior in JUnit-5, we need to pull in a new dependency in the `streams` gradle project.

Reviewers: Guozhang Wang <wangguoz@gmail.com>
pull/13427/head
Lucas Brutschy 2 years ago committed by GitHub
parent
commit
6fae237638
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      build.gradle
  2. 6
      streams/src/test/java/org/apache/kafka/streams/state/internals/metrics/RocksDBMetricsRecorderTest.java

1
build.gradle

@ -1945,6 +1945,7 @@ project(':streams') { @@ -1945,6 +1945,7 @@ project(':streams') {
testImplementation libs.bcpkix
testImplementation libs.hamcrest
testImplementation libs.mockitoInline // supports mocking static methods, final classes, etc.
testImplementation libs.mockitoJunitJupiter // supports MockitoExtension
testRuntimeOnly project(':streams:test-utils')
testRuntimeOnly libs.slf4jlog4j

6
streams/src/test/java/org/apache/kafka/streams/state/internals/metrics/RocksDBMetricsRecorderTest.java

@ -27,8 +27,12 @@ import org.junit.jupiter.api.AfterAll; @@ -27,8 +27,12 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
import org.rocksdb.Cache;
import org.rocksdb.HistogramData;
import org.rocksdb.HistogramType;
@ -52,6 +56,8 @@ import static org.mockito.Mockito.verifyNoInteractions; @@ -52,6 +56,8 @@ import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
@MockitoSettings(strictness = Strictness.STRICT_STUBS)
public class RocksDBMetricsRecorderTest {
private final static String METRICS_SCOPE = "metrics-scope";
private final static TaskId TASK_ID1 = new TaskId(0, 0);

Loading…
Cancel
Save