Skip to content

Commit f531139

Browse files
committed
Fixed mockito
1 parent 9859e4f commit f531139

File tree

3 files changed

+33
-13
lines changed

3 files changed

+33
-13
lines changed

topic/pom.xml

+23-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
</dependency>
4949
<dependency>
5050
<groupId>org.mockito</groupId>
51-
<artifactId>mockito-inline</artifactId>
51+
<artifactId>mockito-core</artifactId>
5252
<scope>test</scope>
5353
</dependency>
5454
<dependency>
@@ -62,4 +62,26 @@
6262
<scope>test</scope>
6363
</dependency>
6464
</dependencies>
65+
66+
<profiles>
67+
<profile>
68+
<id>jdk8-build</id>
69+
<activation>
70+
<jdk>1.8</jdk>
71+
</activation>
72+
73+
<properties>
74+
<!-- Downgrade Mockito to 4 version -->
75+
<mockito.version>4.11.0</mockito.version>
76+
</properties>
77+
78+
<dependencies>
79+
<dependency>
80+
<groupId>org.mockito</groupId>
81+
<artifactId>mockito-inline</artifactId>
82+
<version>${mockito.version}</version>
83+
</dependency>
84+
</dependencies>
85+
</profile>
86+
</profiles>
6587
</project>

topic/src/main/java/tech/ydb/topic/settings/ReaderSettings.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import tech.ydb.common.retry.RetryConfig;
1313
import tech.ydb.common.retry.RetryPolicy;
1414
import tech.ydb.core.Status;
15-
import tech.ydb.core.StatusCode;
1615
import tech.ydb.topic.impl.GrpcStreamRetrier;
1716

1817
/**
@@ -143,15 +142,15 @@ public Builder setErrorsHandler(BiConsumer<Status, Throwable> handler) {
143142
final RetryConfig currentConfig = retryConfig;
144143
retryConfig = new RetryConfig() {
145144
@Override
146-
public RetryPolicy isStatusRetryable(StatusCode code) {
147-
handler.accept(Status.of(code), null);
148-
return currentConfig.isStatusRetryable(code);
145+
public RetryPolicy getStatusRetryPolicy(Status status) {
146+
handler.accept(status, null);
147+
return currentConfig.getStatusRetryPolicy(status);
149148
}
150149

151150
@Override
152-
public RetryPolicy isThrowableRetryable(Throwable th) {
151+
public RetryPolicy getThrowableRetryPolicy(Throwable th) {
153152
handler.accept(null, th);
154-
return currentConfig.isThrowableRetryable(th);
153+
return currentConfig.getThrowableRetryPolicy(th);
155154
}
156155
};
157156
return this;

topic/src/main/java/tech/ydb/topic/settings/WriterSettings.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import tech.ydb.common.retry.RetryConfig;
66
import tech.ydb.common.retry.RetryPolicy;
77
import tech.ydb.core.Status;
8-
import tech.ydb.core.StatusCode;
98
import tech.ydb.topic.description.Codec;
109
import tech.ydb.topic.impl.GrpcStreamRetrier;
1110

@@ -187,15 +186,15 @@ public Builder setErrorsHandler(BiConsumer<Status, Throwable> handler) {
187186
final RetryConfig currentConfig = retryConfig;
188187
retryConfig = new RetryConfig() {
189188
@Override
190-
public RetryPolicy isStatusRetryable(StatusCode code) {
191-
handler.accept(Status.of(code), null);
192-
return currentConfig.isStatusRetryable(code);
189+
public RetryPolicy getStatusRetryPolicy(Status status) {
190+
handler.accept(status, null);
191+
return currentConfig.getStatusRetryPolicy(status);
193192
}
194193

195194
@Override
196-
public RetryPolicy isThrowableRetryable(Throwable th) {
195+
public RetryPolicy getThrowableRetryPolicy(Throwable th) {
197196
handler.accept(null, th);
198-
return currentConfig.isThrowableRetryable(th);
197+
return currentConfig.getThrowableRetryPolicy(th);
199198
}
200199
};
201200
return this;

0 commit comments

Comments
 (0)