mardi 29 novembre 2016

How to mock Environment Interface

I have to fetch path from the property file using Environment interface. In Junits I am not able to mock the Environment Interface. Below is my code. I want something random if I will call the method mentioned. How can I do it?

@Mock private Class object; @InjectMocks Class2 object2;

Mockito.when(object.getFilePath()).thenReturn("Random String");

Aucun commentaire:

Enregistrer un commentaire