Search in sources :

Example 6 with PendingAttributesForView

use of org.robobinding.PendingAttributesForView in project RoboBinding by RoboBinding.

the class BindingAttributeResolverTest method givenTwoCandidateResolvers_whenResolveCompletedAtFirstResolver_thenSecondResolverShouldBeSkipped.

@Test
public void givenTwoCandidateResolvers_whenResolveCompletedAtFirstResolver_thenSecondResolverShouldBeSkipped() {
    ByBindingAttributeMappingsResolver candidateResolver1 = mock(ByBindingAttributeMappingsResolver.class);
    ByBindingAttributeMappingsResolver candidateResolver2 = mock(ByBindingAttributeMappingsResolver.class);
    when(byBindingAttributeMappingsResolverFinder.findCandidates(any(View.class))).thenReturn(newArrayList(candidateResolver1, candidateResolver2));
    BindingAttributeResolver bindingAttributeResolver = new BindingAttributeResolver(byBindingAttributeMappingsResolverFinder);
    PendingAttributesForView pendingAttributesForView = mock(PendingAttributesForView.class);
    when(pendingAttributesForView.isEmpty()).thenReturn(true);
    bindingAttributeResolver.resolve(pendingAttributesForView);
    verify(candidateResolver1).resolve(pendingAttributesForView);
    verify(candidateResolver2, never()).resolve(pendingAttributesForView);
}
Also used : PendingAttributesForView(org.robobinding.PendingAttributesForView) PendingAttributesForView(org.robobinding.PendingAttributesForView) View(android.view.View) Test(org.junit.Test)

Aggregations

PendingAttributesForView (org.robobinding.PendingAttributesForView)6 View (android.view.View)3 Test (org.junit.Test)3 PredefinedPendingAttributesForView (org.robobinding.PredefinedPendingAttributesForView)3 PendingAttributesForViewImpl (org.robobinding.PendingAttributesForViewImpl)1 ViewResolutionErrorsException (org.robobinding.ViewResolutionErrorsException)1 PendingAttributesForViewBuilder.aPendingAttributesForView (org.robobinding.binder.PendingAttributesForViewBuilder.aPendingAttributesForView)1