I am getting classcast exception using the following bit of code in Test case.
Employee employee1= new Employee();
Employee employee2= new Employee();
Employee employee3= new Employee();
int id=1234;
when(employee1.getID()).thenReturn(id);
when(employee2.getID()).thenReturn(id);
when(employee3.getID()).thenReturn(id);
I want to generalize this as
when((((Employee)Matchers.any(Employee.class)).getID())).thenReturn(id);
Am I doing anything wrong?
java.lang.ClassCastException: org.hamcrest.core.IsInstanceOf cannot be cast to com.site.model.Employee