IconMixin implements Mixin { public void setIcon(Drawable icon) { final ImageView iconView = getView(); if (iconView != null) { iconView.setImageDrawable(icon); } } IconMixin(TemplateLayout layout, AttributeSet attrs, int defStyleAttr); void setIcon(Drawable icon); Drawable getIcon();  }
@Test public void testSetIcon() { final ColorDrawable drawable = new ColorDrawable(Color.CYAN); IconMixin mixin = new IconMixin(mTemplateLayout, null, 0); mixin.setIcon(drawable); assertSame(drawable, mIconView.getDrawable()); }