Skip to content

Commit

Permalink
Fixed the junit test case
Browse files Browse the repository at this point in the history
Signed-off-by: dhanendra06 <dhanendra.tech@gmail.com>
  • Loading branch information
dhanendra06 committed Feb 10, 2025
1 parent 29b839b commit 81a89ec
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
Expand Down Expand Up @@ -58,6 +57,7 @@
import io.mosip.registration.processor.status.service.impl.SyncRegistrationServiceImpl;
import io.mosip.registration.processor.status.utilities.RegistrationUtility;
import io.mosip.registration.processor.status.validator.PacketExternalStatusRequestValidator;
import org.springframework.web.reactive.function.client.WebClient;

@RunWith(SpringRunner.class)
@SpringBootTest
Expand All @@ -71,6 +71,10 @@ public class PacketExternalStatusControllerTest {
@Qualifier("selfTokenRestTemplate")
private RestTemplate restTemplate;

@MockBean
@Qualifier("selfTokenWebClient")
private WebClient webClient;

@InjectMocks
PacketExternalStatusController packetExternalStatusController = new PacketExternalStatusController();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
Expand All @@ -40,6 +39,7 @@
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.util.NestedServletException;

import com.fasterxml.jackson.core.JsonProcessingException;
Expand Down Expand Up @@ -81,6 +81,10 @@ public class RegistrationExternalStatusControllerTest {
@Qualifier("selfTokenRestTemplate")
private RestTemplate restTemplate;

@MockBean
@Qualifier("selfTokenWebClient")
private WebClient webClient;

@Autowired
private MockMvc mockMvc;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import jakarta.servlet.http.Cookie;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
Expand Down Expand Up @@ -71,6 +70,7 @@
import io.mosip.registration.processor.status.validator.LostRidRequestValidator;
import io.mosip.registration.processor.status.validator.RegistrationStatusRequestValidator;
import io.mosip.registration.processor.status.validator.RegistrationSyncRequestValidator;
import org.springframework.web.reactive.function.client.WebClient;

/**
* The Class RegistrationStatusControllerTest.
Expand All @@ -90,6 +90,10 @@ public class RegistrationStatusAndSyncControllerTest {
@Qualifier("selfTokenRestTemplate")
private RestTemplate restTemplate;

@MockBean
@Qualifier("selfTokenWebClient")
private WebClient webClient;

/** The registration status controller. */
@InjectMocks
RegistrationStatusController registrationStatusController = new RegistrationStatusController();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
import java.util.Optional;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -34,6 +35,7 @@
import io.mosip.registration.processor.core.spi.restclient.RegistrationProcessorRestClientService;
import io.mosip.registration.processor.rest.client.utils.RestApiClient;
import io.mosip.registration.processor.status.service.impl.InternalAuthDelegateServiceImpl;
import org.springframework.web.reactive.function.client.WebClient;

@RunWith(SpringJUnit4ClassRunner.class)
public class InternalAuthDelegateServiceImplTest {
Expand All @@ -50,6 +52,10 @@ public class InternalAuthDelegateServiceImplTest {
@Mock
RestTemplate restTemplate;

@MockBean
@Qualifier("selfTokenWebClient")
private WebClient webClient;

@Mock
ObjectMapper mapper;

Expand Down Expand Up @@ -82,7 +88,6 @@ public void setup() throws Exception {
Mockito.when(mapper.readValue(anyString(), eq(IndividualIdDto.class))).thenReturn(individualIdDto);
}

@Ignore
@Test
public void authenticateSuccessTest() throws Exception {

Expand Down

0 comments on commit 81a89ec

Please sign in to comment.