use of com.vaadin.flow.template.angular.AngularTemplate in project flow by vaadin.
the class ClientDelegteHandlersTest method attach_methodHasGoodArg_ExceptionIsThrown.
@Test
public void attach_methodHasGoodArg_ExceptionIsThrown() {
UI ui = new UI();
AngularTemplate template = new TemplateWithGoodParametersMethods();
ui.add(template);
ClientDelegateHandlers feature = template.getElement().getNode().getFeature(ClientDelegateHandlers.class);
Assert.assertEquals(10, feature.size());
Set<String> methods = getDeclaredMethods(TemplateWithGoodParametersMethods.class).collect(Collectors.toCollection(HashSet::new));
methods.add(getDeclaredMethods(Template1.class).findFirst().get());
for (int i = 0; i < feature.size(); i++) {
methods.remove(feature.get(i));
}
Assert.assertTrue("Feature doesn't contain methods: " + methods.toString(), methods.isEmpty());
}
use of com.vaadin.flow.template.angular.AngularTemplate in project flow by vaadin.
the class ClientDelegteHandlersTest method attach_overloadedMethod_ExceptionIsThrown.
@Test(expected = IllegalStateException.class)
public void attach_overloadedMethod_ExceptionIsThrown() {
UI ui = new UI();
AngularTemplate template = new ChildTemplateWithOverloadedMethod();
ui.add(template);
}
use of com.vaadin.flow.template.angular.AngularTemplate in project flow by vaadin.
the class ClientDelegteHandlersTest method attach_handlersContainsTemplateMethod.
@Test
public void attach_handlersContainsTemplateMethod() {
UI ui = new UI();
AngularTemplate template = new Template1();
ui.add(template);
ClientDelegateHandlers feature = template.getElement().getNode().getFeature(ClientDelegateHandlers.class);
Assert.assertEquals(1, feature.size());
Assert.assertEquals(getDeclaredMethods(Template1.class).findFirst().get(), feature.get(0));
}
use of com.vaadin.flow.template.angular.AngularTemplate in project flow by vaadin.
the class ClientDelegteHandlersTest method attach_methodReturnType_ExceptionIsThrown.
@Test(expected = IllegalStateException.class)
public void attach_methodReturnType_ExceptionIsThrown() {
UI ui = new UI();
AngularTemplate template = new TemplateWithMethodReturnValue();
ui.add(template);
}
use of com.vaadin.flow.template.angular.AngularTemplate in project flow by vaadin.
the class ClientDelegteHandlersTest method attach_methodWithUncheckedException_handlersContainsTemplateMethod.
@Test
public void attach_methodWithUncheckedException_handlersContainsTemplateMethod() {
UI ui = new UI();
AngularTemplate template = new TemplateWithMethodDeclaringUncheckedException();
ui.add(template);
ClientDelegateHandlers feature = template.getElement().getNode().getFeature(ClientDelegateHandlers.class);
Assert.assertEquals(2, feature.size());
Assert.assertEquals(getDeclaredMethods(TemplateWithMethodDeclaringUncheckedException.class).findFirst().get(), feature.get(0));
}
Aggregations