use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationPropertiesEditorTest method testEnumMapKeyReconciling.
@Test
public void testEnumMapKeyReconciling() 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.color-names.RED=Rood\n" + "foo.color-names.GREEN=Groen\n" + "foo.color-names.BLUE=Blauw\n" + "foo.color-names.NOT_A_COLOR=Wrong\n" + "foo.color-names.BLUE.bad=Blauw\n");
editor.assertProblems("NOT_A_COLOR|Color", // because value type is not dotable the dots will be taken to be part of map key
"BLUE.bad|Color");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationYamlEditorTest method testReconcilePojoArray.
@Test
public void testReconcilePojoArray() throws Exception {
IJavaProject p = createPredefinedMavenProject("boot-1.2.1-app-properties-list-of-pojo");
useProject(p);
assertNotNull(p.getClasspath().findType("demo.Foo"));
{
Editor editor = newEditor("token-bad-guy: problem\n" + "volder:\n" + " foo:\n" + " list:\n" + " - name: Kris\n" + " description: Kris\n" + " roles:\n" + " - Developer\n" + " - Admin\n" + " bogus: Bad\n");
editor.assertProblems("token-bad-guy|Unknown property", // 'description' is ok
"bogus|Unknown property 'bogus' for type 'demo.Foo'");
}
{
// Pojo array can also be entered as a map with integer keys
Editor editor = newEditor("token-bad-guy: problem\n" + "volder:\n" + " foo:\n" + " list:\n" + " 0:\n" + " name: Kris\n" + " description: Kris\n" + " roles:\n" + " 0: Developer\n" + " one: Admin\n" + " bogus: Bad\n");
editor.assertProblems("token-bad-guy|Unknown property", "one|Expecting a 'int' but got 'one'", "bogus|Unknown property 'bogus' for type 'demo.Foo'");
}
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationYamlEditorTest method testHyperlinkTargets.
@Ignore
@Test
public void testHyperlinkTargets() throws Exception {
IJavaProject p = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
useProject(p);
Editor editor = newEditor("server:\n" + " port: 888\n" + "spring:\n" + " datasource:\n" + " login-timeout: 1000\n" + "flyway:\n" + " init-sqls: a,b,c\n");
editor.assertLinkTargets("port", "org.springframework.boot.autoconfigure.web.ServerProperties.setPort(Integer)");
editor.assertLinkTargets("login-", "org.springframework.boot.autoconfigure.jdbc.DataSourceConfigMetadata.hikariDataSource()", "org.springframework.boot.autoconfigure.jdbc.DataSourceConfigMetadata.tomcatDataSource()", "org.springframework.boot.autoconfigure.jdbc.DataSourceConfigMetadata.dbcpDataSource()");
editor.assertLinkTargets("init-sql", "org.springframework.boot.autoconfigure.flyway.FlywayProperties.setInitSqls(List<String>)");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationYamlEditorTest method testEnumPropertyReconciling.
@Test
public void testEnumPropertyReconciling() throws Exception {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.getClasspath().findType("demo.Color"));
data("foo.color", "demo.Color", null, "A foonky colour");
Editor editor = newEditor("foo:\n" + " color: BLUE\n" + "---\n" + "foo:\n" + " color: RED\n" + "---\n" + "foo:\n" + " color: GREEN\n" + "---\n" + "foo:\n" + " color:\n" + " bad: BLUE\n" + "---\n" + "foo:\n" + " color: Bogus\n");
editor.assertProblems("bad: BLUE|demo.Color", "Bogus|demo.Color");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationYamlEditorTest method testReconcileCamelCaseBeanProp.
@Test
public void testReconcileCamelCaseBeanProp() throws Exception {
Editor editor;
IJavaProject p = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
useProject(p);
data("demo.bean", "demo.CamelCaser", "For testing tolerance of camelCase", null);
// Nothing special... not using camel case
editor = newEditor("#Comment for good measure\n" + "demo:\n" + " bean:\n" + " the-answer-to-everything: not-a-number\n");
editor.assertProblems("not-a-number|Expecting a 'int'");
// Now check that reconcile also tolerates camel case and reports no error for it
editor = newEditor("#Comment for good measure\n" + "demo:\n" + " bean:\n" + " theAnswerToEverything: 42\n");
editor.assertProblems();
// Now check that reconciler traverses camelCase and reports errors assigning to camelCase names
editor = newEditor("#Comment for good measure\n" + "demo:\n" + " bean:\n" + " theAnswerToEverything: not-a-number\n");
editor.assertProblems("not-a-number|Expecting a 'int'");
// Now check also that camelcase tolerance works if its not in the end of the path
editor = newEditor("#Comment for good measure\n" + "demo:\n" + " bean:\n" + " theAnswerToEverything: not-a-number\n" + " theLeft:\n" + " bad: wrong\n" + " theAnswerToEverything: not-this\n");
editor.assertProblems("not-a-number|Expecting a 'int'", "bad|Unknown property", "not-this|Expecting a 'int'");
}
Aggregations