0
我有這個類如何在虛空方法應用於JUnit測試
@Value("${norsys.loadfile.directory}")
private String chemin;
@RequestMapping(value = "/{fileName:.+}", method = RequestMethod.GET)
@ResponseBody()
public void loadVideoFile(@PathVariable("fileName") String fileName,HttpServletResponse response) {
try {
response.setContentType("video/mp4");
Files.copy(Paths.get(chemin, fileName), response.getOutputStream());
response.flushBuffer();
} catch (java.io.FileNotFoundException e) {
response.setStatus(HttpStatus.NOT_FOUND.value());
} catch (Exception e) {
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
}
}
我不知道如何應用JUnit測試,以保持覆蓋率高,我希望你可以給我一個想法,謝謝