which guru know's the best practice to test the behavier of this class, so that whenever AsyncCallback is called, it should go into onSuccess method. To print out "onSuccess".
@RunWith(MockitoJUnitRunner.class)
public class InterfaceTest {
@Mock
private Service service;
private Employee employee;
@Before
public void setUp() throws Exception {
employee = mock(Employee.class);
}
@Test
public void testMockBehavier() throws Exception {
}
}
interface AsyncCallback {
void onError();
void onSuccess();
}
class Employee {
@Autowired
Service service;
public void save(){
service.save(new AsyncCallback() {
@Override
public void onError() {
System.out.println("Error");
}
@Override
public void onSuccess() {
System.out.println("Success");
}
});
}
}
interface Service {
void save(AsyncCallback asyncCallback);
}
I haven't found out how to access an anonymous inner class. Very appreciate for good practice tipps.
Thanks