### Question:
FileUploadManager implements Serializable { public void handleFileRemoval(String id) { try { UploadFile uploadedFile = findUploadedFile(id); uploadedFiles.remove(uploadedFile); currentFileLimit++; LOGGER.debug("removed: {}", uploadedFile); FacesMessage message = new FacesMessage( FacesMessage.SEVERITY_INFO, "File removed", uploadedFile.getName() + " is successfuly removed"); FacesContext.getCurrentInstance().addMessage(null, message); } catch (Exception exception) { LOGGER.error("unable to remove file with id: {}", id, exception); FacesContext.getCurrentInstance().addMessage( null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Removal failed", "File with id:" + id + " not found")); } }  @PostConstruct void init(); List<UploadFile> getUploadedFiles(); String getUploadId(); void handleFileUpload(FileUploadEvent event); void handleFileRemoval(String id); String handleFileSubmit(); String getCurrentFileLimit(); StreamedContent getImage(); static final int FILE_LIMIT; }### Answer:
@Test public void testHandleFileRemovalNotFound() { fileUploadManager.handleFileRemoval("123"); verify(facesContext, times(1)).addMessage(any(String.class), any(FacesMessage.class)); }
@Test public void testHandleFileRemoval() { FileUploadEvent event = new FileUploadEvent(uiComponent, nativeUploadedFile); fileUploadManager.handleFileUpload(event); fileUploadManager.handleFileRemoval(fileUploadManager .getUploadedFiles().get(0).getId()); verify(facesContext, times(2)).addMessage(any(String.class), any(FacesMessage.class)); }