Want to mock File.readAllBytes to throw error first and then bytes[]..
getQueryTextFromFile is a private method and calling from another method to get bytes[]
private byte[] getQueryTextFromFile() {
try {
File file = new File("./");
byte[] refreshTableQueryBytes = Files
.readAllBytes(Paths.get(file.getAbsolutePath() +"src/resources/queryFile"));
return refreshTableQueryBytes;
} catch (IOException e) {
logger.error("Exception while fetching query details");
}
return null;
}
How to mock here to throw IOException using Mockito Framework