I have been trying to mock the feign client call from Services in a spring boot implementation for writing the Junit test cases.
//Service code
@Autowired
private PersonClient personClient;
//Using the personClient
public Person someMethod(){
//Interface defined with URL and all defination
Person person = personClient.getPerson();
}
//Service testing bean
@RunWith(MockitoJUnitRunner.class)
public Class ServiceTest{
@Mock
public PersonClient mockPersonClient;
@Test
public someTestClient(){
when(mockPersonClient.getPerson()).return(new Person("name",12));
Person person = mockPersionClient.getPerson();
assertEquals(new Person("name",12), person);
}
}
Above is not working, I am new to feign client, hence not sure how to mock the feign client interface.
Is there any other way to achieve same thing above.