Add support to test harness for checking highlights.

This commit is contained in:
Kris De Volder
2017-10-24 12:52:49 -07:00
parent 5652e8402e
commit c71d4cbf02
7 changed files with 115 additions and 13 deletions

View File

@@ -10,6 +10,8 @@
*******************************************************************************/
package org.springframework.ide.vscode.boot.java.profile;
import java.time.Duration;
import org.junit.Before;
import org.junit.Test;
import org.springframework.ide.vscode.commons.util.text.LanguageId;
@@ -31,6 +33,7 @@ public class ActiveProfilesHoverTest {
harness = BootLanguageServerHarness.builder()
.mockDefaults()
.runningAppProvider(mockAppProvider.provider)
.watchDogInterval(Duration.ofMillis(100))
.build();
harness.useProject(projects.mavenProject("empty-boot-15-web-app"));
harness.intialize(null);
@@ -60,6 +63,10 @@ public class ActiveProfilesHoverTest {
editor.assertHoverContains("@Profile", "local-profile");
editor.assertHoverContains("@Profile", "foo.bar.RunningApp");
editor.assertHoverContains("@Profile", "22022");
editor.assertHighlights(
"@Profile(\"local\")"
);
}

View File

@@ -10,6 +10,8 @@
*******************************************************************************/
package org.springframework.ide.vscode.project.harness;
import java.time.Duration;
import org.junit.Assert;
import org.springframework.ide.vscode.boot.java.BootJavaLanguageServer;
import org.springframework.ide.vscode.boot.java.BootJavaLanguageServerParams;
@@ -46,6 +48,7 @@ public class BootLanguageServerHarness extends LanguageServerHarness<BootJavaLan
private SpringPropertyIndexProvider indexProvider = null;
private RunningAppProvider runningAppProvider = null;
private PropertyIndexHarness indexHarness = null;
private Duration watchDogInterval = null;
public BootLanguageServerHarness build() throws Exception {
BootLanguageServerHarness harness = new BootLanguageServerHarness(this);
@@ -75,6 +78,11 @@ public class BootLanguageServerHarness extends LanguageServerHarness<BootJavaLan
this.indexProvider = propertyIndexProvider;
return this;
}
public Builder watchDogInterval(Duration watchDogInterval) {
this.watchDogInterval = watchDogInterval;
return this;
}
}
/**
@@ -88,7 +96,8 @@ public class BootLanguageServerHarness extends LanguageServerHarness<BootJavaLan
builder.projectFinder==null?defaults.projectFinder:builder.projectFinder,
builder.projectObserver==null?defaults.projectObserver:builder.projectObserver,
builder.indexProvider==null?defaults.indexProvider:builder.indexProvider,
builder.runningAppProvider==null?defaults.runningAppProvider:builder.runningAppProvider
builder.runningAppProvider==null?defaults.runningAppProvider:builder.runningAppProvider,
builder.watchDogInterval==null?defaults.watchDogInterval:builder.watchDogInterval
);
};
return new BootJavaLanguageServer(params);