@Test public void getFileNameShouldBeExecuted() { view.file = mock(FileUpload.class); when(view.file.getFilename()).thenReturn("fileName"); view.getFileName(); verify(view.file).getFilename(); }
@Override @Nonnull public String getFileName() { String fileName = file.getFilename(); if (fileName.contains("/") || fileName.contains("\\")) { int index = fileName.contains("\\") ? fileName.lastIndexOf("\\") + 1 : fileName.lastIndexOf("/") + 1; fileName = fileName.substring(index); } return fileName; }
UploadFileViewImpl extends Window implements UploadFileView { @Override @Nonnull public String getFileName() { String fileName = file.getFilename(); if (fileName.contains("/") || fileName.contains("\\")) { int index = fileName.contains("\\") ? fileName.lastIndexOf("\\") + 1 : fileName.lastIndexOf("/") + 1; fileName = fileName.substring(index); } return fileName; } }
UploadFileViewImpl extends Window implements UploadFileView { @Override @Nonnull public String getFileName() { String fileName = file.getFilename(); if (fileName.contains("/") || fileName.contains("\\")) { int index = fileName.contains("\\") ? fileName.lastIndexOf("\\") + 1 : fileName.lastIndexOf("/") + 1; fileName = fileName.substring(index); } return fileName; } @Inject  UploadFileViewImpl(UploadFileViewBinder uploadFileViewBinder, CoreLocalizationConstant locale); }
UploadFileViewImpl extends Window implements UploadFileView { @Override @Nonnull public String getFileName() { String fileName = file.getFilename(); if (fileName.contains("/") || fileName.contains("\\")) { int index = fileName.contains("\\") ? fileName.lastIndexOf("\\") + 1 : fileName.lastIndexOf("/") + 1; fileName = fileName.substring(index); } return fileName; } @Inject  UploadFileViewImpl(UploadFileViewBinder uploadFileViewBinder, CoreLocalizationConstant locale); @Override void showDialog(); @Override void closeDialog(); @Override void setDelegate(ActionDelegate delegate); @Override void setEnabledUploadButton(boolean enabled); @Override void setEncoding(@Nonnull String encodingType); @Override void setAction(@Nonnull String url); @Override void submit(); @Override @Nonnull String getFileName(); @Override boolean isOverwriteFileSelected(); }
UploadFileViewImpl extends Window implements UploadFileView { @Override @Nonnull public String getFileName() { String fileName = file.getFilename(); if (fileName.contains("/") || fileName.contains("\\")) { int index = fileName.contains("\\") ? fileName.lastIndexOf("\\") + 1 : fileName.lastIndexOf("/") + 1; fileName = fileName.substring(index); } return fileName; } @Inject  UploadFileViewImpl(UploadFileViewBinder uploadFileViewBinder, CoreLocalizationConstant locale); @Override void showDialog(); @Override void closeDialog(); @Override void setDelegate(ActionDelegate delegate); @Override void setEnabledUploadButton(boolean enabled); @Override void setEncoding(@Nonnull String encodingType); @Override void setAction(@Nonnull String url); @Override void submit(); @Override @Nonnull String getFileName(); @Override boolean isOverwriteFileSelected();  }