C10NFilters { public static <T> C10NFilterProvider<T> cachedFilterProvider(C10NFilterProvider<T> filterProvider) { Preconditions.assertNotNull(filterProvider, "filterProvider"); return new CachedC10NFilterProvider<T>(filterProvider); }  static C10NFilterProvider<E> enumMapping(Class<E> enumClass, Class<?> c10nMappedInterface); static C10NFilterProvider<T> staticFilterProvider(C10NFilter<T> filter); static C10NFilterProvider<T> cachedFilterProvider(C10NFilterProvider<T> filterProvider);  }
@Test public void cachedFilterProviderOnlyInstantiatesFilterOnce() { MyFilterProvider mfp = new MyFilterProvider(); C10NFilterProvider<Object> cfp = C10NFilters.cachedFilterProvider(mfp); assertThat(mfp.called, is(0)); C10NFilter<Object> mf = cfp.get(); assertThat(mfp.called, is(1)); cfp.get(); cfp.get(); assertThat(mfp.called, is(1)); assertThat(cfp.get(), is(sameInstance(mf))); }