use of com.redhat.qute.commons.JavaTypeInfo in project quarkus-ls by redhat-developer.
the class TemplateGetJavaTypeTest method item.
@Test
public void item() throws Exception {
loadMavenProject(QuteMavenProjectName.qute_quickstart);
QuteJavaTypesParams params = new QuteJavaTypesParams("Item", QuteMavenProjectName.qute_quickstart);
List<JavaTypeInfo> actual = QuteSupportForTemplate.getInstance().getJavaTypes(params, getJDTUtils(), new NullProgressMonitor());
assertJavaTypes(//
actual, //
t("org.acme.qute.Item", JavaTypeKind.Class), t("org.acme.qute.ItemResource", JavaTypeKind.Class));
}
use of com.redhat.qute.commons.JavaTypeInfo in project quarkus-ls by redhat-developer.
the class TemplateGetJavaTypeTest method assertJavaType.
/**
* Assert Java type.
*
* @param actual the actual java types.
* @param expected the expected Java type.
*/
private static void assertJavaType(List<JavaTypeInfo> actualTypes, JavaTypeInfo expected) {
List<JavaTypeInfo> matches = actualTypes.stream().filter(completion -> {
return expected.getSignature().equals(completion.getSignature());
}).collect(Collectors.toList());
Assert.assertEquals(//
expected.getSignature() + " should only exist once: Actual: " + //
actualTypes.stream().map(c -> c.getSignature()).collect(Collectors.joining(",")), 1, matches.size());
JavaTypeInfo actual = matches.get(0);
Assert.assertEquals("Test 'type name' for '" + expected.getSignature() + "'", expected.getSignature(), actual.getSignature());
Assert.assertEquals("Test 'kind' for '" + expected.getSignature() + "'", expected.getJavaElementKind(), actual.getJavaElementKind());
}
use of com.redhat.qute.commons.JavaTypeInfo in project quarkus-ls by redhat-developer.
the class TemplateGetJavaTypeTest method packages.
@Test
public void packages() throws Exception {
loadMavenProject(QuteMavenProjectName.qute_quickstart);
QuteJavaTypesParams params = new QuteJavaTypesParams("java.", QuteMavenProjectName.qute_quickstart);
List<JavaTypeInfo> actual = QuteSupportForTemplate.getInstance().getJavaTypes(params, getJDTUtils(), new NullProgressMonitor());
assertJavaTypes(//
actual, //
t("java.util", JavaTypeKind.Package), t("java.lang", JavaTypeKind.Package));
}
use of com.redhat.qute.commons.JavaTypeInfo in project quarkus-ls by redhat-developer.
the class TemplateGetJavaTypeTest method list.
@Test
public void list() throws Exception {
loadMavenProject(QuteMavenProjectName.qute_quickstart);
QuteJavaTypesParams params = new QuteJavaTypesParams("List", QuteMavenProjectName.qute_quickstart);
List<JavaTypeInfo> actual = QuteSupportForTemplate.getInstance().getJavaTypes(params, getJDTUtils(), new NullProgressMonitor());
assertJavaTypes(//
actual, t("java.util.List<E>", JavaTypeKind.Interface));
}
use of com.redhat.qute.commons.JavaTypeInfo in project quarkus-ls by redhat-developer.
the class TemplateGetJavaTypeTest method t.
public static JavaTypeInfo t(String typeName, JavaTypeKind kind) {
JavaTypeInfo javaType = new JavaTypeInfo();
javaType.setSignature(typeName);
javaType.setKind(kind);
return javaType;
}
Aggregations