### Question:
RunNotifier { RunListener wrapIfNotThreadSafe(RunListener listener) { return listener.getClass().isAnnotationPresent(RunListener.ThreadSafe.class) ? listener : new SynchronizedRunListener(listener, this); }  void addListener(RunListener listener); void removeListener(RunListener listener); void fireTestRunStarted(final Description description); void fireTestRunFinished(final Result result); void fireTestStarted(final Description description); void fireTestFailure(Failure failure); void fireTestAssumptionFailed(final Failure failure); void fireTestIgnored(final Description description); void fireTestFinished(final Description description); void pleaseStop(); void addFirstListener(RunListener listener);  }### Answer:
@Test public void wrapIfNotThreadSafeShouldNotWrapThreadSafeListeners() { ThreadSafeListener listener = new ThreadSafeListener();; assertSame(listener, new RunNotifier().wrapIfNotThreadSafe(listener)); }
@Test public void wrapIfNotThreadSafeShouldWrapNonThreadSafeListeners() { CountingListener listener = new CountingListener(); RunListener wrappedListener = new RunNotifier().wrapIfNotThreadSafe(listener); assertThat(wrappedListener, instanceOf(SynchronizedRunListener.class)); }