diff --git a/src/test/java/it/gov/pagopa/wispconverter/ApiTest.java b/src/test/java/it/gov/pagopa/wispconverter/ApiTest.java index 05a66750..2d904421 100644 --- a/src/test/java/it/gov/pagopa/wispconverter/ApiTest.java +++ b/src/test/java/it/gov/pagopa/wispconverter/ApiTest.java @@ -28,9 +28,12 @@ import org.apache.commons.io.IOUtils; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ValueOperations; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; @@ -58,7 +61,8 @@ class ApiTest { @MockBean private GPDClient gpdClient; @MockBean private CheckoutClient checkoutClient; @MockBean private DecouplerCachingClient decouplerCachingClient; - @MockBean private CacheRepository cacheRepository; + @Qualifier("redisSimpleTemplate") + @MockBean private RedisTemplate redisSimpleTemplate; public String loadFileContent(String fileName) { String content = null; @@ -135,6 +139,10 @@ void success() throws Exception { ).build() ) ); + when(redisSimpleTemplate.opsForValue()).thenReturn(mock(ValueOperations.class)); + + + mvc.perform(MockMvcRequestBuilders.get("/redirect?sessionId=aaaaaaaaaaaa").accept(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().is3xxRedirection()) .andDo(