From 8e3ea44d7783c6a02be07f3d690c319162a15844 Mon Sep 17 00:00:00 2001 From: Marcus Hert Da Coregio Date: Mon, 20 Nov 2023 09:53:13 -0300 Subject: [PATCH] Try fixing flaky test by replacing BDDMockito with regular Mockito Issue gh-2645 --- etc/checkstyle/suppressions.xml | 1 + .../redis/RedisIndexedSessionRepositoryDynamicITests.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/checkstyle/suppressions.xml b/etc/checkstyle/suppressions.xml index 8fb7378a..4849e359 100644 --- a/etc/checkstyle/suppressions.xml +++ b/etc/checkstyle/suppressions.xml @@ -8,4 +8,5 @@ + diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisIndexedSessionRepositoryDynamicITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisIndexedSessionRepositoryDynamicITests.java index 7e816dc6..cb2481f8 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisIndexedSessionRepositoryDynamicITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisIndexedSessionRepositoryDynamicITests.java @@ -33,7 +33,7 @@ import org.springframework.web.context.support.AnnotationConfigWebApplicationCon import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.willThrow; +import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.spy; /** @@ -69,7 +69,7 @@ class RedisIndexedSessionRepositoryDynamicITests extends AbstractRedisITests { RedisSystemException redisSystemException = new RedisSystemException(null, new RedisCommandExecutionException("ERR no such key. channel: [id: 0xec125091,...")); - willThrow(redisSystemException).given(this.spyOperations).rename(any(), any()); + doThrow(redisSystemException).when(this.spyOperations).rename(any(), any()); this.sessionRepository.save(session); assertThat(this.sessionRepository.findById(sessionId)).isNull();