SimpleMapFactory implements MapFactory { @Override public Element cloneElement(final Element element, final Schema schema) { return cloner.cloneElement(element, schema); } SimpleMapFactory(); protected  SimpleMapFactory(final ElementCloner cloner); @Override void initialise(final Schema schema, final MapStoreProperties properties); @Override Map<K, V> getMap(final String mapName, final Class<K> keyClass, final Class<V> valueClass); @Override MultiMap<K, V> getMultiMap(final String mapName, final Class<K> keyClass, final Class<V> valueClass); @Override void clear(); @Override Element cloneElement(final Element element, final Schema schema); static final String MAP_CLASS; static final String MAP_CLASS_DEFAULT; }
@Test public void shouldCloneElementUsingCloner() throws StoreException { final ElementCloner elementCloner = mock(ElementCloner.class); final Element element = mock(Element.class); final Element expectedClonedElement = mock(Element.class); final Schema schema = mock(Schema.class); final SimpleMapFactory factory = new SimpleMapFactory(elementCloner); given(elementCloner.cloneElement(element, schema)).willReturn(expectedClonedElement); final Element clonedElement = factory.cloneElement(element, schema); verify(elementCloner).cloneElement(element, schema); assertSame(expectedClonedElement, clonedElement); assertNotSame(element, clonedElement); }