### Question:
MasterInstrumenter extends CompositeInstrumenter { @Override public Object createInstrumentedProxy(Test test, Recorder recorder, Object target) throws NotWrappableTypeException { if (target == null) { throw new NotWrappableTypeException("Can't wrap null/None"); } final Object result = super.createInstrumentedProxy(test, recorder, target); if (result != null) { return result; } throw new NotWrappableTypeException("Failed to wrap " + target); } MasterInstrumenter(List<Instrumenter> instrumenters); @Override Object createInstrumentedProxy(Test test,
                                                  Recorder recorder,
                                                  Object target); @Override boolean instrument(Test test,
                                      Recorder recorder,
                                      Object target,
                                      InstrumentationFilter filter); @Override String getDescription();  }### Answer:
@Test public void testCreateInstrumentedProxy() throws Exception { when(m_instrumenter2.createInstrumentedProxy(m_test, m_recorder, m_target)) .thenReturn(m_target); final Instrumenter instrumenter = new MasterInstrumenter(asList(m_instrumenter1, m_instrumenter2)); instrumenter.createInstrumentedProxy(m_test, m_recorder, m_target); final InOrder inOrder = inOrder(m_instrumenter1, m_instrumenter2); inOrder.verify(m_instrumenter1) .createInstrumentedProxy(m_test, m_recorder, m_target); inOrder.verify(m_instrumenter2) .createInstrumentedProxy(m_test, m_recorder, m_target); verifyNoMoreInteractions(m_instrumenter1, m_instrumenter2); }
@Test public void testCreateInstrumentedProxyWithNull() throws Exception { final Instrumenter instrumenter = new MasterInstrumenter(asList(m_instrumenter1, m_instrumenter2)); try { instrumenter.createInstrumentedProxy(m_test, m_recorder, null); fail("Expected NotWrappableTypeException"); } catch (NotWrappableTypeException e) { } }
@Test public void testCreateInstrumentedProxyFailure() throws Exception { final Instrumenter instrumenter = new MasterInstrumenter(asList(m_instrumenter1, m_instrumenter2)); try { instrumenter.createInstrumentedProxy(m_test, m_recorder, m_target); fail("Expected NotWrappableTypeException"); } catch (NotWrappableTypeException e) { } }