lundi 22 février 2016

Use Mockito to make a partial mock

You've got a class that you need to override the behavior of one of it's methods. How to partially mock "size" with Mockito?

class NaughtyLinkedList extends LinkedList {
    public int size() { throw new RuntimeException("don't call me");}
}

Aucun commentaire:

Enregistrer un commentaire