Skip to content

Commit

Permalink
added unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo-catalano committed Apr 4, 2024
1 parent b79fe02 commit dff37f3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/test/java/it/gov/pagopa/wispconverter/ApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String, Object> redisSimpleTemplate;

public String loadFileContent(String fileName) {
String content = null;
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit dff37f3

Please sign in to comment.