### Question:
OpenTracingTracerFactory extends JmsTracerFactory { public static JmsTracer create(Tracer tracer) { return create(tracer, false); }  static JmsTracer create(Tracer tracer); static JmsTracer create(Tracer tracer, boolean closeUnderlyingTracer); @Override JmsTracer createTracer(URI remoteURI, String name);  }### Answer:
@Test public void testCreateWithProvidedTracer() { Tracer mock = Mockito.mock(Tracer.class); JmsTracer jmsTracer = OpenTracingTracerFactory.create(mock); assertEquals("Unexpected tracer instance type", OpenTracingTracer.class, jmsTracer.getClass()); Mockito.verifyNoInteractions(mock); jmsTracer.close(); Mockito.verifyNoInteractions(mock); }
@Test public void testCreateWithProvidedTracerCloseProvider() { Tracer mock = Mockito.mock(Tracer.class); JmsTracer jmsTracerDontClose = OpenTracingTracerFactory.create(mock, false); Mockito.verifyNoInteractions(mock); jmsTracerDontClose.close(); Mockito.verifyNoInteractions(mock); JmsTracer jmsTracerClose = OpenTracingTracerFactory.create(mock, true); Mockito.verifyNoInteractions(mock); jmsTracerClose.close(); Mockito.verify(mock).close(); Mockito.verifyNoMoreInteractions(mock); }
@Test public void testCreateWithURIAndTypeName() throws Exception { JmsTracer jmsTracer = OpenTracingTracerFactory.create(new URI("amqp: assertEquals("Unexpected tracer instance type", OpenTracingTracer.class, jmsTracer.getClass()); }
@Test public void testCreateWithURIAndTypeNameUnknown() throws Exception { try { OpenTracingTracerFactory.create(new URI("amqp: fail("Exception was not thrown"); } catch (Exception e) { } }