Commit 6c0102d2 authored by Naren Medarametla's avatar Naren Medarametla

Added Junit test cases

parent 0c701ae8
...@@ -6,8 +6,6 @@ import org.springframework.context.annotation.PropertySource; ...@@ -6,8 +6,6 @@ import org.springframework.context.annotation.PropertySource;
import org.springframework.web.client.*; import org.springframework.web.client.*;
@Configuration @Configuration
@PropertySource("classpath:application.properties")
public class OfferTransactionConfig { public class OfferTransactionConfig {
@Bean @Bean
......
...@@ -11,8 +11,11 @@ import org.junit.runner.RunWith; ...@@ -11,8 +11,11 @@ import org.junit.runner.RunWith;
import org.mockito.*; import org.mockito.*;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -20,6 +23,7 @@ import java.util.List; ...@@ -20,6 +23,7 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
@PropertySource("classpath:application-test.yml")
public class OfferServiceTest { public class OfferServiceTest {
@Mock @Mock
...@@ -47,6 +51,7 @@ public class OfferServiceTest { ...@@ -47,6 +51,7 @@ public class OfferServiceTest {
@Test @Test
public void serviceTest() { public void serviceTest() {
ReflectionTestUtils.setField(springJunitService, "securityKey", "it's a security key");
OfferTransactionRequest offerTransactionRequest = getOfferTransactionRequest(); OfferTransactionRequest offerTransactionRequest = getOfferTransactionRequest();
Mockito.when(offerLookupRepo.findAll()).thenReturn(returnOffers()); Mockito.when(offerLookupRepo.findAll()).thenReturn(returnOffers());
Mockito.when(offerConverter.apply(getOfferTransactionRequest())).thenReturn(getPEReq()); Mockito.when(offerConverter.apply(getOfferTransactionRequest())).thenReturn(getPEReq());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment