@Test public void testDefinedTransform() throws Exception { TransformingMap map = new TransformingMap( Collections.<String, Object>singletonMap(KEY, VALUE), Collections.singletonMap(KEY, transformer)); context.checking(new Expectations() { { oneOf(transformer).transform(VALUE); will(returnValue(VALUE)); } }); assertThat(map.get(KEY), is(sameInstance((Object) VALUE))); }
private Object transform(Object s, Transformer<Object, Object> transformer) { if (transformer == null) return s; if (s instanceof Iterable) { List<Object> t = new LinkedList<>(); for (Object obj : (Iterable<?>) s) { t.add(transformer.transform(obj)); } return t; } else { return transformer.transform(s); } }
TransformingMap extends AbstractMap<String, Object> implements Serializable { private Object transform(Object s, Transformer<Object, Object> transformer) { if (transformer == null) return s; if (s instanceof Iterable) { List<Object> t = new LinkedList<>(); for (Object obj : (Iterable<?>) s) { t.add(transformer.transform(obj)); } return t; } else { return transformer.transform(s); } } }
TransformingMap extends AbstractMap<String, Object> implements Serializable { private Object transform(Object s, Transformer<Object, Object> transformer) { if (transformer == null) return s; if (s instanceof Iterable) { List<Object> t = new LinkedList<>(); for (Object obj : (Iterable<?>) s) { t.add(transformer.transform(obj)); } return t; } else { return transformer.transform(s); } } TransformingMap(Map<String, Object> delegate, 
      Map<String, Transformer<Object, Object>> transformers); }
TransformingMap extends AbstractMap<String, Object> implements Serializable { private Object transform(Object s, Transformer<Object, Object> transformer) { if (transformer == null) return s; if (s instanceof Iterable) { List<Object> t = new LinkedList<>(); for (Object obj : (Iterable<?>) s) { t.add(transformer.transform(obj)); } return t; } else { return transformer.transform(s); } } TransformingMap(Map<String, Object> delegate, 
      Map<String, Transformer<Object, Object>> transformers); @Override Set<Map.Entry<String, Object>> entrySet(); }
TransformingMap extends AbstractMap<String, Object> implements Serializable { private Object transform(Object s, Transformer<Object, Object> transformer) { if (transformer == null) return s; if (s instanceof Iterable) { List<Object> t = new LinkedList<>(); for (Object obj : (Iterable<?>) s) { t.add(transformer.transform(obj)); } return t; } else { return transformer.transform(s); } } TransformingMap(Map<String, Object> delegate, 
      Map<String, Transformer<Object, Object>> transformers); @Override Set<Map.Entry<String, Object>> entrySet();  }