DecorFactory { public View onViewCreated(View view, String name, View parent, Context context, AttributeSet attrs) { if (view == null) { return null; } for (Decorator d : decorators) { d.apply(view, parent, name, context, attrs); } return view; } DecorFactory(Collection<Decorator> decorators); View onViewCreated(View view,  String name,  View parent,  Context context, AttributeSet attrs); View onViewCreated(View view, Context context, AttributeSet attrs);  }
@Test public void addDecoratorDoesApplyIt() throws Exception { String name = "android.view.View"; decorFactory.onViewCreated(view, name, parent, context, attributeSet); verify(decorator).apply(view, parent, name, context, attributeSet); }
@Test public void NoDecoratorAppliedToNullView() throws Exception { String name = "android.view.View"; decorFactory.onViewCreated(null, name, parent, context, attributeSet); verify(decorator, never()).apply(null, parent, name, context, attributeSet); }