### Question:
AttachmentFileWidget extends Composite { public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); } AttachmentFileWidget();  AttachmentFileWidget(final String[] validFileExtensions);  AttachmentFileWidget(final boolean addFileUpload);  AttachmentFileWidget(final String[] validFileExtensions,
                                final boolean addFileUpload); void reset(); void submit(final Path context,
                       final String fileName,
                       final String targetUrl,
                       final Command successCallback,
                       final Command errorCallback); void submit(final Path path,
                       final String targetUrl,
                       final Command successCallback,
                       final Command errorCallback); void addClickHandler(final ClickHandler clickHandler); void setEnabled(boolean b); void showMessage(String message); String getFilenameSelectedToUpload();  }### Answer:
@Test public void formSubmitValidState() { editor.setValid(true); editor.submit(path, "filename", "targetUrl", successCallback, errorCallback); verify(form, times(1)).submit(); }
@Test public void formSubmitInvalidState() { editor.setValid(false); editor.submit(path, "filename", "targetUrl", successCallback, errorCallback); verify(form, never()).submit(); }
@Test public void testSubmitCompleteInvalidXlsContent() throws Exception { when(event.getResults()).thenReturn("DecisionTableParseException"); editor.setValid(true); editor.submit(path, "filename", "targetUrl", successCallback, errorCallback); verify(form).addSubmitCompleteHandler(submitCompleteCaptor.capture()); submitCompleteCaptor.getValue().onSubmitComplete(event); assertEquals(1, editor.getShownMessages().size()); assertEquals(CommonConstants.INSTANCE.UploadGenericError(), editor.getShownMessages().get(0)); }