use of com.vaadin.flow.template.angular.model.ListModelType in project flow by vaadin.
the class ModelDescriptorTest method listInsideList.
@Test
public void listInsideList() {
ModelDescriptor<?> descriptor = ModelDescriptor.get(ListInsideListBeanModel.class);
Assert.assertEquals(1, descriptor.getPropertyNames().count());
ListModelType<?> listPropertyType = (ListModelType<?>) descriptor.getPropertyType("beans");
Type javaType = listPropertyType.getJavaType();
Assert.assertTrue("Expected instanceof ParameterizedType for List", javaType instanceof ParameterizedType);
javaType = ((ParameterizedType) javaType).getActualTypeArguments()[0];
Assert.assertTrue("Expected instanceof ParameterizedType for List in List", javaType instanceof ParameterizedType);
Assert.assertEquals(Bean.class, ((ParameterizedType) javaType).getActualTypeArguments()[0]);
Assert.assertTrue(listPropertyType.getItemType() instanceof ListModelType<?>);
ListModelType<?> type = (ListModelType<?>) listPropertyType.getItemType();
Assert.assertTrue(type.getItemType() instanceof BeanModelType<?>);
BeanModelType<?> modelType = (BeanModelType<?>) type.getItemType();
Assert.assertSame(Bean.class, modelType.getProxyType());
}
use of com.vaadin.flow.template.angular.model.ListModelType in project flow by vaadin.
the class ModelDescriptorTest method listInsideListInsideList.
@Test
public void listInsideListInsideList() {
ModelDescriptor<?> descriptor = ModelDescriptor.get(ListInsideListInsideList.class);
Assert.assertEquals(1, descriptor.getPropertyNames().count());
ListModelType<?> listPropertyType = (ListModelType<?>) descriptor.getPropertyType("beans");
Type javaType = listPropertyType.getJavaType();
Assert.assertTrue("Expected instanceof ParameterizedType for List", javaType instanceof ParameterizedType);
javaType = ((ParameterizedType) javaType).getActualTypeArguments()[0];
Assert.assertTrue("Expected instanceof ParameterizedType for List in List", javaType instanceof ParameterizedType);
javaType = ((ParameterizedType) javaType).getActualTypeArguments()[0];
Assert.assertTrue("Expected instanceof ParameterizedType for List in List in List", javaType instanceof ParameterizedType);
Assert.assertEquals(Bean.class, ((ParameterizedType) javaType).getActualTypeArguments()[0]);
Assert.assertTrue(listPropertyType.getItemType() instanceof ListModelType<?>);
ListModelType<?> type = (ListModelType<?>) listPropertyType.getItemType();
Assert.assertTrue(type.getItemType() instanceof ListModelType<?>);
type = (ListModelType<?>) type.getItemType();
Assert.assertTrue(type.getItemType() instanceof BeanModelType<?>);
BeanModelType<?> modelType = (BeanModelType<?>) type.getItemType();
Assert.assertSame(Bean.class, modelType.getProxyType());
}
Aggregations