I need help with the unit test case. I want to mock static method write(Path path, byte[] bytes, OpenOption... options)
of java.nio.file.Files
class.
I tried eg. in that way:
PowerMockito.doReturn(path).when(Files.class, "write", path, someString.getBytes());
In this case the method is not found.
PowerMockito.doReturn(path).when(Files.class, PowerMockito.method(Files.class, "write", Path.class, byte[]
.class, OpenOption.class));
This time i have UnfinishedStubbingException
.
How can I do it correct?
Aucun commentaire:
Enregistrer un commentaire