DockerFile implements VirtualFile { @Override public Promise<String> getContent() { return AsyncPromiseHelper.createFromAsyncRequest(new AsyncPromiseHelper.RequestCall<String>() { @Override public void makeCall(AsyncCallback<String> callback) { for (Link link : data.getLinks()) { if (GET_CONTENT.equals(link.getRel())) { sendRequest(callback, link.getHref()); break; } } } }); } DockerFile(@NotNull ProjectServiceClient projectServiceClient,
                      @NotNull ItemReference data); @Override boolean isReadOnly(); @Override Promise<String> getContent(); @NotNull @Override String getPath(); @NotNull @Override String getName(); @Override String getDisplayName(); @Nullable @Override String getMediaType(); @Nullable @Override HasProjectDescriptor getProject(); @Override String getContentUrl(); @Override Promise<Void> updateContent(final String content); static final String GET_CONTENT; }
@Test public void contentShouldBeReturned() throws Exception { Link link1 = mock(Link.class); Link link2 = mock(Link.class); when(data.getLinks()).thenReturn(Arrays.asList(link2, link1)); when(link1.getRel()).thenReturn(DockerFile.GET_CONTENT); when(link1.getHref()).thenReturn(SOME_TEXT); when(link2.getRel()).thenReturn(SOME_TEXT); dockerFile.getContent(); }