use of org.robobinding.viewattribute.ViewAttributeBinder in project RoboBinding by RoboBinding.
the class ByBindingAttributeMappingsResolverTest method givenAnAttributeGroup_whenResolve_thenAResolvedGroupedViewAttributeShouldBeReturned.
@Test
public void givenAnAttributeGroup_whenResolve_thenAResolvedGroupedViewAttributeShouldBeReturned() {
String[] attributeGroup = { "group_attribute1", "group_attribute2" };
GroupedViewAttributeBinder viewAttributeBinder = Mockito.mock(GroupedViewAttributeBinder.class);
ByBindingAttributeMappingsResolver byBindingAttributeMappingsResolver = newByBindingAttributeMappingsResolver(aBindingAttributeMappings().withAttributeGroup(attributeGroup, viewAttributeBinder).build());
Collection<ViewAttributeBinder> viewAttributes = byBindingAttributeMappingsResolver.resolve(pendingAttributesForView);
assertThat(Sets.newHashSet(viewAttributes), equalTo(Sets.<ViewAttributeBinder>newHashSet(viewAttributeBinder)));
}
use of org.robobinding.viewattribute.ViewAttributeBinder in project RoboBinding by RoboBinding.
the class ByBindingAttributeMappingsResolverTest method givenAnEventAttribute_whenResolve_thenAResolvedEventViewAttributeShouldBeReturned.
@Test
public void givenAnEventAttribute_whenResolve_thenAResolvedEventViewAttributeShouldBeReturned() {
EventViewAttributeBinder viewAttributeBinder = Mockito.mock(EventViewAttributeBinder.class);
ByBindingAttributeMappingsResolver byBindingAttributeMappingsResolver = newByBindingAttributeMappingsResolver(aBindingAttributeMappings().withEventAttribute("eventAttribute", viewAttributeBinder).build());
Collection<ViewAttributeBinder> viewAttributes = byBindingAttributeMappingsResolver.resolve(pendingAttributesForView);
assertThat(Sets.newHashSet(viewAttributes), equalTo(Sets.<ViewAttributeBinder>newHashSet(viewAttributeBinder)));
}
use of org.robobinding.viewattribute.ViewAttributeBinder in project RoboBinding by RoboBinding.
the class BindingAttributeResolver method resolve.
public ViewResolutionResult resolve(PendingAttributesForView pendingAttributesForView) {
List<ViewAttributeBinder> resolvedViewAttributes = Lists.newArrayList();
Iterable<ByBindingAttributeMappingsResolver> resolvers = byBindingAttributeMappingsResolverFinder.findCandidates(pendingAttributesForView.getView());
for (ByBindingAttributeMappingsResolver resolver : resolvers) {
Collection<ViewAttributeBinder> newResolvedViewAttributes = resolver.resolve(pendingAttributesForView);
resolvedViewAttributes.addAll(newResolvedViewAttributes);
if (pendingAttributesForView.isEmpty())
break;
}
ViewResolutionErrors errors = pendingAttributesForView.getResolutionErrors();
ResolvedBindingAttributesForView resolvedBindingAttributes = new ResolvedBindingAttributesForView(pendingAttributesForView.getView(), resolvedViewAttributes);
return new ViewResolutionResult(resolvedBindingAttributes, errors);
}
use of org.robobinding.viewattribute.ViewAttributeBinder in project RoboBinding by RoboBinding.
the class FromClassViewAttributeFactoriesTest method shouldCreateNewInstanceFromClass.
@Test
public void shouldCreateNewInstanceFromClass() {
ViewAttributeBinder viewAttributeBinder = FromClassViewAttributeFactories.newViewAttribute(ViewAttributeBinderImpl.class);
assertNotNull(viewAttributeBinder);
}
use of org.robobinding.viewattribute.ViewAttributeBinder in project RoboBinding by RoboBinding.
the class ByBindingAttributeMappingsResolverTest method givenAMultiTypePropertyAttribute_whenResolve_thenAResolvedMultiTypePropertyViewAttributeShouldBeReturned.
@Test
public void givenAMultiTypePropertyAttribute_whenResolve_thenAResolvedMultiTypePropertyViewAttributeShouldBeReturned() {
MultiTypePropertyViewAttributeBinder viewAttributeBinder = Mockito.mock(MultiTypePropertyViewAttributeBinder.class);
ByBindingAttributeMappingsResolver byBindingAttributeMappingsResolver = newByBindingAttributeMappingsResolver(aBindingAttributeMappings().withMultiTypePropertyAttribute("multiTypePropertyAttribute", viewAttributeBinder).build());
Collection<ViewAttributeBinder> viewAttributes = byBindingAttributeMappingsResolver.resolve(pendingAttributesForView);
assertThat(Sets.newHashSet(viewAttributes), equalTo(Sets.<ViewAttributeBinder>newHashSet(viewAttributeBinder)));
}
Aggregations