ChooserMappingFactory { public static <T> Map<IsolationLevel, Chooser<T>> buildChooserMapping(Consumer<T> reportDelegateUsageWarning) { Map<IsolationLevel, Chooser<T>> chooserMap = new HashMap<>(); chooserMap.put(IsolationLevel.NONE, new NoneIsolationChooser<>()); chooserMap.put(IsolationLevel.TRANSITIONAL, new TransitionalIsolationChooser<>(reportDelegateUsageWarning)); chooserMap.put(IsolationLevel.FULL, new FullIsolationChooser<>()); return Collections.unmodifiableMap(chooserMap); }  static Map<IsolationLevel, Chooser<T>> buildChooserMapping(Consumer<T> reportDelegateUsageWarning); static Map<IsolationLevel, Chooser<List<T>>> buildChooserMappingForList(Consumer<List<T>> reportDelegateUsageWarning);  }
@Test public void testBuildChooserMapping() { Map<IsolationLevel, Chooser<String>> chooserMappingFactory = ChooserMappingFactory.buildChooserMapping(obj -> { }); assertTrue(chooserMappingFactory.get(IsolationLevel.NONE) instanceof NoneIsolationChooser); assertTrue(chooserMappingFactory.get(IsolationLevel.TRANSITIONAL) instanceof TransitionalIsolationChooser); assertTrue(chooserMappingFactory.get(IsolationLevel.FULL) instanceof FullIsolationChooser); }