Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

mock a service when the method returning void


doAnswer((i) -> {
	System.out.println("Employee setName Argument = " + i.getArgument(0));
	assertTrue("Pankaj".equals(i.getArgument(0)));
	return null;
}).when(emp).setName(anyString());
Source by www.journaldev.com #
 
PREVIOUS NEXT
Tagged: #mock #service #method #returning #void
ADD COMMENT
Topic
Name
5+4 =