### Question:
ByBindingAttributeMappingsResolver { public Collection<ViewAttributeBinder> resolve(PendingAttributesForView pendingAttributesForView) { resolvedViewAttributes = Lists.newArrayList(); resolvePropertyViewAttributes(pendingAttributesForView); resolveMultiTypePropertyViewAttributes(pendingAttributesForView); resolveCommandViewAttributes(pendingAttributesForView); resolveGroupedViewAttributes(pendingAttributesForView); List<ViewAttributeBinder> temp = resolvedViewAttributes; resolvedViewAttributes = null; return temp; } ByBindingAttributeMappingsResolver(InitailizedBindingAttributeMappings bindingAttributeMappings); Collection<ViewAttributeBinder> resolve(PendingAttributesForView pendingAttributesForView);  }### Answer:
@Test public void givenAPropertyAttribute_whenResolve_thenAResolvedPropertyViewAttributeShouldBeReturned() { PropertyViewAttributeBinder viewAttributeBinder = Mockito.mock(PropertyViewAttributeBinder.class); ByBindingAttributeMappingsResolver byBindingAttributeMappingsResolver = newByBindingAttributeMappingsResolver( aBindingAttributeMappings().withPropertyAttribute("propertyAttribute", viewAttributeBinder).build()); Collection<ViewAttributeBinder> viewAttributes = byBindingAttributeMappingsResolver.resolve(pendingAttributesForView); assertThat(Sets.newHashSet(viewAttributes), equalTo(Sets.<ViewAttributeBinder> newHashSet(viewAttributeBinder))); }
@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))); }
@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))); }
@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))); }