AABindableLayoutBuilder extends DefaultBindableLayoutBuilder { @Override public View build( @NonNull ViewGroup parent, int viewType, Object item, @NonNull Mapper mapper) { Class<? extends BindableLayout> viewClass = mapper.viewClassFromViewType(viewType); if (viewClass == null) { throw new IllegalArgumentException("viewType not present in the mapper"); } try { Method method = Reflections.method(viewClass, "build", Context.class); return (ViewGroup) method.invoke(null, parent.getContext()); } catch (NoSuchMethodException e) { throw new IllegalArgumentException("View class is not a @EViewGroup generated by AndroidAnnotations", e); } catch (InvocationTargetException e) { throw new RuntimeException("Invocation Target", e); } catch (IllegalAccessException e) { throw new RuntimeException("Illegal Access ", e); } }  @Override View build(
            @NonNull ViewGroup parent, int viewType, Object item, @NonNull Mapper mapper);  }
@Test public void test_build() { AABindableLayoutBuilder builder = new AABindableLayoutBuilder(); int viewType = mapper.viewTypeFromViewClass(builder.viewType(mockModel2, 0, mapper)); View bindableLayout = builder.build(parent, viewType, mockModel2, mapper); assertNotNull(bindableLayout); MockLayout2 mockLayout = (MockLayout2) bindableLayout; assertTrue(mockLayout.fromBuild); }
@Test(expected = IllegalArgumentException.class) public void test_crash_if_not_aa() { AABindableLayoutBuilder builder = new AABindableLayoutBuilder(); int viewType = mapper.viewTypeFromViewClass(builder.viewType(mockModel, 0, mapper)); View bindableLayout = builder.build(parent, viewType, mockModel, mapper); }
@Test(expected = IllegalArgumentException.class) public void test_crash_if_unknown_view_class() { AABindableLayoutBuilder builder = new AABindableLayoutBuilder(); int viewType = mapper.viewTypeFromViewClass(builder.viewType(0, 0, mapper)); View bindableLayout = builder.build(parent, 0, null, mapper); }