vendredi 21 septembre 2018

My mocked method returns the same instance on each call, how do I get it to return a new instance?

private mockedObject cpMock;

@Test
public void test() {

    Manager managerTest = new Manager(cpMock, size);

    Instance instance = new Instance(size);
    when(cpMock.requestInstance()).thenReturn(instance);

}

Aucun commentaire:

Enregistrer un commentaire