use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationPropertiesEditorTest method testPojoCompletions.
@Test
public void testPojoCompletions() throws Exception {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.getClasspath().findType("demo.Color"));
assertNotNull(p.getClasspath().findType("demo.ColorData"));
assertCompletion("foo.dat<*>", "foo.data.<*>");
assertCompletionsDisplayStringAndDetail("foo.data.", new String[] { "children", "List<demo.ColorData>" }, new String[] { "color-children", "Map<demo.Color[BLUE, GREEN, RED], demo.ColorData>" }, new String[] { "funky", "boolean" }, new String[] { "mapped-children", "Map<String, demo.ColorData>" }, new String[] { "name", "String" }, new String[] { "nested", "demo.ColorData" }, new String[] { "next", "demo.Color[BLUE, GREEN, RED]" }, new String[] { "tags", "List<String>" }, new String[] { "wavelen", "double" });
assertCompletionsVariations("foo.data.wav<*>", "foo.data.wavelen=<*>");
assertCompletionsVariations("foo.data.nam<*>", "foo.data.name=<*>");
assertCompletionsVariations("foo.data.nex<*>", "foo.data.next=<*>");
assertCompletionsVariations("foo.data.nes<*>", "foo.data.nested.<*>");
assertCompletionsVariations("foo.data.chi<*>", "foo.data.children[<*>", // fuzzy
"foo.data.color-children.<*>", // fuzzy
"foo.data.mapped-children.<*>");
assertCompletionsVariations("foo.data.tag<*>", "foo.data.tags=<*>");
assertCompletionsVariations("foo.data.map<*>", "foo.data.mapped-children.<*>");
assertCompletionsVariations("foo.data.col<*>", "foo.data.color-children.<*>");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationPropertiesEditorTest method testHyperlinkTargetsLoggingLevel.
@Ignore
@Test
public void testHyperlinkTargetsLoggingLevel() throws Exception {
System.out.println(">>> testHyperlinkTargetsLoggingLevel");
IJavaProject p = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
useProject(p);
Editor editor = newEditor("logging.level.com.acme=INFO\n");
editor.assertLinkTargets("level", "org.springframework.boot.logging.LoggingApplicationListener");
System.out.println("<<< testHyperlinkTargetsLoggingLevel");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationPropertiesEditorTest method testEnumMapValueReconciling.
@Test
public void testEnumMapValueReconciling() throws Exception {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
data("foo.name-colors", "java.util.Map<java.lang.String,demo.Color>", null, "Map with colors in its values");
assertNotNull(p.getClasspath().findType("demo.Color"));
Editor editor = newEditor("foo.name-colors.jacket=BLUE\n" + "foo.name-colors.hat=RED\n" + "foo.name-colors.pants=GREEN\n" + "foo.name-colors.wrong=NOT_A_COLOR\n");
editor.assertProblems("NOT_A_COLOR|Color");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationPropertiesEditorTest method testEnumPropertyCompletionInsideCommaSeparateList.
@Test
public void testEnumPropertyCompletionInsideCommaSeparateList() throws Exception {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.getClasspath().findType("demo.Color"));
data("foo.colors", "java.util.List<demo.Color>", null, "A foonky list");
// Completion requested right after '=' sign:
assertCompletionsDisplayString("foo.colors=<*>", "red", "green", "blue");
assertCompletionWithLabel("foo.colors=<*>", "red", "foo.colors=red<*>");
assertCompletion("foo.colors=R<*>", "foo.colors=RED<*>");
assertCompletion("foo.colors=g<*>", "foo.colors=green<*>");
assertCompletion("foo.colors=B<*>", "foo.colors=BLUE<*>");
// Completion requested after ','
assertCompletionsDisplayString("foo.colors=red,<*>", "red", "green", "blue");
assertCompletionWithLabel("foo.colors=red,<*>", "green", "foo.colors=red,green<*>");
assertCompletion("foo.colors=RED,R<*>", "foo.colors=RED,RED<*>");
assertCompletion("foo.colors=RED,G<*>", "foo.colors=RED,GREEN<*>");
assertCompletion("foo.colors=RED,B<*>", "foo.colors=RED,BLUE<*>");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationPropertiesEditorTest method testPojoReconciling.
@Test
public void testPojoReconciling() throws Exception {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.getClasspath().findType("demo.Color"));
assertNotNull(p.getClasspath().findType("demo.ColorData"));
Editor editor = newEditor("foo.data.bogus=Something\n" + "foo.data.wavelen=3.0\n" + "foo.data.wavelen=not a double\n" + "foo.data.wavelen.more=3.0\n" + "foo.data.wavelen[0]=3.0\n");
// ignore deliberate abuse of dups
editor.ignoreProblem(PROP_DUPLICATE_KEY);
editor.assertProblems("bogus|no property", "not a double|'double'", ".more|Can't use '.' navigation", "[0]|Can't use '[..]' navigation");
}
Aggregations