Different ways of using thenReturn

This post shows 3 different ways of using thenReturn. 1) First way involves configuring the mock object to return only one return value as shown below when(class1.method1()).thenReturn(2); The above code instructs Mockito to return 2, whenever we call class1.method1 (once or more than once, the return value will always be 2) 2) Second way involves…… Continue reading Different ways of using thenReturn