FileUploadPopupView extends AbstractScenarioPopupView implements FileUploadPopup { @EventHandler("file") public void onFileChangeEvent(ChangeEvent event) { fileName = file.getValue(); if (fileName.toLowerCase().startsWith(FAKEPATH)) { fileName = fileName.substring(FAKEPATH.length()); } fileText.setValue(fileName); JavaScriptObject files = file.getPropertyJSO("files"); readTextFile(files); if (!"".equals(fileText.getValue())) { okButton.setEnabled(true); } }  static void fileLoaded(String fileContents); @Override void init(); @Override void show(final String mainTitleText,
                     final String okButtonText,
                     final Command okCommand); @Override void show(final String mainTitleText,
                     final String uploadWarningText,
                     final String okButtonText,
                     final Command okCommand); @Override String getFileContents(); @Override String getFileName(); @Override void setAcceptedExtension(List<String> acceptedExtension); @EventHandler("chooseButton") void onChooseButtonClickEvent(ClickEvent clickEvent); @EventHandler("file") void onFileChangeEvent(ChangeEvent event); static native void readTextFile(JavaScriptObject files);  }
@Test public void onFileChangeEvent() { when(fileMock.getValue()).thenReturn(VALUE); ChangeEvent changeEventMock = mock(ChangeEvent.class); ((FileUploadPopupView) popupView).onFileChangeEvent(changeEventMock); verify(fileMock, times(1)).getValue(); verify(fileTextMock, times(1)).setValue(eq(VALUE)); }