Adjust unit tests

This commit is contained in:
BoykoAlex
2017-10-27 11:08:10 -04:00
parent a29b2d0a3b
commit 06e86a33a4
2 changed files with 8 additions and 4 deletions

View File

@@ -16,6 +16,7 @@ import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.Annotation;
@@ -144,7 +145,7 @@ public class RequestMappingHoverProvider implements HoverProvider {
String port = mappingMethod.getT2().getPort();
String host = mappingMethod.getT2().getHost();
List<Renderable> renderableUrls = Arrays.stream(mappingMethod.getT1().getSplitPath()).map(path -> {
List<Renderable> renderableUrls = Arrays.stream(mappingMethod.getT1().getSplitPath()).flatMap(path -> {
String url = UrlUtil.createUrl(host, port, path);
StringBuilder builder = new StringBuilder();
builder.append("[");
@@ -153,10 +154,13 @@ public class RequestMappingHoverProvider implements HoverProvider {
builder.append("(");
builder.append(url);
builder.append(")");
return Renderables.concat(Renderables.text(builder.toString()), Renderables.lineBreak());
return Stream.of(Renderables.text(builder.toString()), Renderables.lineBreak());
})
.collect(Collectors.toList());
// Remove the last line break
renderableUrls.remove(renderableUrls.size() - 1);
hoverContent.add(Either.forLeft(Renderables.concat(renderableUrls).toMarkdown()));
hoverContent.add(Either.forLeft("Process ID: " + processId));
hoverContent.add(Either.forLeft("Process Name: " + processName));

View File

@@ -62,7 +62,7 @@ public class RequestMappingLiveHoverTest {
harness.intialize(directory);
Editor editor = harness.newEditorFromFileUri(docUri, LanguageId.JAVA);
editor.assertHoverContains("@RequestMapping(\"/hello-world\")", "[http://cfapps.io:1111/hello-world](http://cfapps.io:1111/hello-world)\n" +
editor.assertHoverContains("@RequestMapping(method=RequestMethod.GET)", "[http://cfapps.io:1111/hello-world](http://cfapps.io:1111/hello-world)\n" +
"\n" +
"Process ID: 22022\n" +
"\n" +
@@ -310,7 +310,7 @@ public class RequestMappingLiveHoverTest {
"}",
docUri);
editor.assertHoverContains("@RequestMapping(value={\"/greetings\", \"/hello\"}, method=GET)", "[http://cfapps.io:999/greetings](http://cfapps.io:999/greetings)\n" +
editor.assertHoverContains("@RequestMapping(value={\"/greetings\", \"/hello\"}, method=GET)", "[http://cfapps.io:999/greetings](http://cfapps.io:999/greetings) \n" +
"[http://cfapps.io:999/hello](http://cfapps.io:999/hello)\n" +
"\n" +
"Process ID: 76543\n" +