@Test public void testDeleteWhenDeleteIsFailed() throws Exception { doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { Object[] arguments = invocation.getArguments(); AsyncRequestCallback<Void> callback = (AsyncRequestCallback<Void>)arguments[1]; GwtReflectionUtils.callOnFailure(callback, mock(Throwable.class)); return callback; } }).when(projectServiceClient).delete(anyString(), (AsyncRequestCallback<Void>)anyObject()); DeleteCallback callback = mock(DeleteCallback.class); fileNode.delete(callback); verify(projectServiceClient).delete(eq(ITEM_PATH), Matchers.<AsyncRequestCallback<Void>>anyObject()); verify(callback).onFailure(Matchers.<Throwable>anyObject()); }
@Override public void delete(final DeleteCallback callback) { super.delete(new DeleteCallback() { @Override public void onDeleted() { eventBus.fireEvent(new FileEvent(FileNode.this, FileEvent.FileOperation.CLOSE)); callback.onDeleted(); } @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } }); }
FileNode extends ItemNode implements VirtualFile { @Override public void delete(final DeleteCallback callback) { super.delete(new DeleteCallback() { @Override public void onDeleted() { eventBus.fireEvent(new FileEvent(FileNode.this, FileEvent.FileOperation.CLOSE)); callback.onDeleted(); } @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } }); } }
FileNode extends ItemNode implements VirtualFile { @Override public void delete(final DeleteCallback callback) { super.delete(new DeleteCallback() { @Override public void onDeleted() { eventBus.fireEvent(new FileEvent(FileNode.this, FileEvent.FileOperation.CLOSE)); callback.onDeleted(); } @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } }); } @Inject  FileNode(@Assisted TreeNode<?> parent,
                    @Assisted ItemReference data,
                    @Assisted TreeStructure treeStructure,
                    EventBus eventBus,
                    ProjectServiceClient projectServiceClient,
                    DtoUnmarshallerFactory dtoUnmarshallerFactory); }
FileNode extends ItemNode implements VirtualFile { @Override public void delete(final DeleteCallback callback) { super.delete(new DeleteCallback() { @Override public void onDeleted() { eventBus.fireEvent(new FileEvent(FileNode.this, FileEvent.FileOperation.CLOSE)); callback.onDeleted(); } @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } }); } @Inject  FileNode(@Assisted TreeNode<?> parent,
                    @Assisted ItemReference data,
                    @Assisted TreeStructure treeStructure,
                    EventBus eventBus,
                    ProjectServiceClient projectServiceClient,
                    DtoUnmarshallerFactory dtoUnmarshallerFactory); @Override boolean isLeaf(); @Override void processNodeAction(); @Override void delete(final DeleteCallback callback); @Nullable @Override String getMediaType(); @Override boolean isReadOnly(); @Override String getContentUrl(); void getContent(final AsyncCallback<String> callback); void updateContent(String content, final AsyncCallback<Void> callback); @Override boolean equals(Object o); @Override int hashCode(); @Override boolean canContainsFolder(); }
FileNode extends ItemNode implements VirtualFile { @Override public void delete(final DeleteCallback callback) { super.delete(new DeleteCallback() { @Override public void onDeleted() { eventBus.fireEvent(new FileEvent(FileNode.this, FileEvent.FileOperation.CLOSE)); callback.onDeleted(); } @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } }); } @Inject  FileNode(@Assisted TreeNode<?> parent,
                    @Assisted ItemReference data,
                    @Assisted TreeStructure treeStructure,
                    EventBus eventBus,
                    ProjectServiceClient projectServiceClient,
                    DtoUnmarshallerFactory dtoUnmarshallerFactory); @Override boolean isLeaf(); @Override void processNodeAction(); @Override void delete(final DeleteCallback callback); @Nullable @Override String getMediaType(); @Override boolean isReadOnly(); @Override String getContentUrl(); void getContent(final AsyncCallback<String> callback); void updateContent(String content, final AsyncCallback<Void> callback); @Override boolean equals(Object o); @Override int hashCode(); @Override boolean canContainsFolder();  }