Skip to content

Commit

Permalink
MOSIP-32461 code changes
Browse files Browse the repository at this point in the history
Signed-off-by: Sowmya Ujjappa Banakar <[email protected]>
  • Loading branch information
Sowmya Ujjappa Banakar committed May 23, 2024
1 parent d5d9519 commit e2aa5ec
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
import javax.net.ssl.SSLException;
import javax.net.ssl.TrustManagerFactory;

import java.util.function.Consumer;
import org.apache.hc.core5.http.ParseException;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
Expand Down Expand Up @@ -61,16 +63,18 @@
import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder;
import reactor.core.publisher.Mono;
import reactor.netty.http.client.HttpClient;


@Ignore
@ContextConfiguration(classes = { TestContext.class, WebApplicationContext.class })
@RunWith(PowerMockRunner.class)
@PowerMockIgnore({"com.sun.org.apache.*", "javax.xml.*", "org.xml.*", "javax.management.*"})
@PowerMockIgnore({ "com.sun.org.apache.*", "javax.xml.*", "org.xml.*", "javax.management.*", "javax.crypto.*" })
@PowerMockRunnerDelegate(SpringJUnit4ClassRunner.class)
@WebMvcTest
@AutoConfigureMockMvc
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@PrepareForTest({ WebClient.class, SslContextBuilder.class, Mock.class })
@PrepareForTest({ WebClient.class, SslContextBuilder.class, Mock.class, HttpClient.class })
public class RestHelperTest {

/** The rest helper. */
Expand All @@ -88,6 +92,7 @@ public class RestHelperTest {
@MockBean
private RestApiClient restApiClient;

@SuppressWarnings("deprecation")
@Before
public void before() throws IOException, ParseException {
PowerMockito.mockStatic(SslContextBuilder.class);
Expand All @@ -97,6 +102,11 @@ public void before() throws IOException, ParseException {
.thenReturn(sslContextBuilder);
PowerMockito.when(sslContextBuilder.build()).thenReturn(Mockito.mock(SslContext.class));
Mockito.when(restApiClient.getToken()).thenReturn("Gjnaiuhs==");
PowerMockito.mockStatic(HttpClient.class);
HttpClient httpClient = Mockito.mock(HttpClient.class);

PowerMockito.when(HttpClient.create()).thenReturn(httpClient);
Mockito.when(httpClient.secure(Mockito.any(Consumer.class))).thenReturn(httpClient);
}

/**
Expand Down

0 comments on commit e2aa5ec

Please sign in to comment.