use of com.vaadin.generator.metadata.ComponentObjectType in project flow by vaadin.
the class ComponentGeneratorTest method classContainsObjectProperty_componentContainsValueProperty_generatedClassImplementsHasValue.
@Test
public void classContainsObjectProperty_componentContainsValueProperty_generatedClassImplementsHasValue() {
ComponentObjectType objectType = new ComponentObjectType();
ComponentPropertyData property = new ComponentPropertyData();
property.setName("value");
property.setObjectType(Collections.singletonList(objectType));
componentMetadata.setProperties(Collections.singletonList(property));
ComponentEventData event = new ComponentEventData();
event.setName("value-changed");
componentMetadata.setEvents(Collections.singletonList(event));
String generatedClass = generator.generateClass(componentMetadata, "com.my.test", null);
generatedClass = ComponentGeneratorTestUtils.removeIndentation(generatedClass);
ComponentGeneratorTestUtils.assertClassImplementsInterface(generatedClass, "MyComponent", HasValue.class);
Assert.assertThat(generatedClass, CoreMatchers.containsString("@Override public ValueProperty getValue() { JsonObject _obj = (JsonObject) getElement().getPropertyRaw("));
Assert.assertThat(generatedClass, CoreMatchers.containsString("@Override public void setValue(ValueProperty property) { if (!Objects.equals(property, getValue()))"));
}
use of com.vaadin.generator.metadata.ComponentObjectType in project flow by vaadin.
the class NestedClassGeneratorTest method init.
@Before
public void init() {
generator = new NestedClassGenerator();
type = new ComponentObjectType();
}
Aggregations