We have several test which run until version 1.21 of JMockit. From version 1.22 we get a 'ClassCastException'. The problem there is that the spring JpaRepository retuns a repository instance itself instead of a generic domain class.
Repository
public interface StateRepository extends JpaRepository<State, Long> {
...
Runtime code
@Autowired
StateRepository stateRepo;
...
activity.setState(stateRepo.findOne(stateId)); //returns repo instead of domain pojo
JUnit test
@Tested
StateUpdater stateUpdater;
@Injectable
StateRepository stateRepo;