@Test public void testGettingContentWhenGetContentIsFailed() throws Exception { doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { Object[] arguments = invocation.getArguments(); AsyncRequestCallback<String> callback = (AsyncRequestCallback<String>)arguments[1]; GwtReflectionUtils.callOnFailure(callback, mock(Throwable.class)); return callback; } }).when(projectServiceClient).getFileContent(anyString(), (AsyncRequestCallback<String>)anyObject()); AsyncCallback<String> callback = mock(AsyncCallback.class); fileNode.getContent(callback); verify(projectServiceClient).getFileContent(eq(ITEM_PATH), Matchers.<AsyncRequestCallback<String>>anyObject()); verify(callback).onFailure(Matchers.<Throwable>anyObject()); }
public void getContent(final AsyncCallback<String> callback) { projectServiceClient.getFileContent(getPath(), new AsyncRequestCallback<String>(new StringUnmarshaller()) { @Override protected void onSuccess(String result) { callback.onSuccess(result); } @Override protected void onFailure(Throwable exception) { callback.onFailure(exception); } }); }
FileNode extends ItemNode implements VirtualFile { public void getContent(final AsyncCallback<String> callback) { projectServiceClient.getFileContent(getPath(), new AsyncRequestCallback<String>(new StringUnmarshaller()) { @Override protected void onSuccess(String result) { callback.onSuccess(result); } @Override protected void onFailure(Throwable exception) { callback.onFailure(exception); } }); } }
FileNode extends ItemNode implements VirtualFile { public void getContent(final AsyncCallback<String> callback) { projectServiceClient.getFileContent(getPath(), new AsyncRequestCallback<String>(new StringUnmarshaller()) { @Override protected void onSuccess(String result) { callback.onSuccess(result); } @Override protected void onFailure(Throwable exception) { callback.onFailure(exception); } }); } @Inject  FileNode(@Assisted TreeNode<?> parent,
                    @Assisted ItemReference data,
                    @Assisted TreeStructure treeStructure,
                    EventBus eventBus,
                    ProjectServiceClient projectServiceClient,
                    DtoUnmarshallerFactory dtoUnmarshallerFactory); }
FileNode extends ItemNode implements VirtualFile { public void getContent(final AsyncCallback<String> callback) { projectServiceClient.getFileContent(getPath(), new AsyncRequestCallback<String>(new StringUnmarshaller()) { @Override protected void onSuccess(String result) { callback.onSuccess(result); } @Override protected void onFailure(Throwable exception) { callback.onFailure(exception); } }); } @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 { public void getContent(final AsyncCallback<String> callback) { projectServiceClient.getFileContent(getPath(), new AsyncRequestCallback<String>(new StringUnmarshaller()) { @Override protected void onSuccess(String result) { callback.onSuccess(result); } @Override protected void onFailure(Throwable exception) { callback.onFailure(exception); } }); } @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();  }