source: class BeanReplicatorTest {
  
      @Test
      public void test() {
  
target:         ComplexBean from = new ComplexBean("foo");
          ComplexBean[] a = { from };
          Collection<ComplexBean> col = Arrays.asList(a);
          from.setArray(a);
          from.setCollection(col);
          Map<String, ComplexBean> map = new HashMap<String, ComplexBean>();
          map.put(from.getName(), from);
          from.setMap(map);
          from.setClazz(List.class);
  
          ComplexBean to = new BeanReplicator().replicateBean(from);
  
          assertThat(from.getName(), is("foo"));
          assertThat(from.getArray()[0], sameInstance(from));
          assertThat(from.getCollection().iterator().next(), sameInstance(from));
          assertThat(from.getMap().get(from.getName()), sameInstance(from));
  
          assertThat(from, not(sameInstance(to)));
  
          assertThat(from.getName(), is(to.getName()));
          assertThat(to.getArray()[0], sameInstance(to));
          assertThat(to.getArray().length, is(1));
          assertThat(to.getCollection().iterator().next(), sameInstance(to));
          assertThat(to.getCollection().size(), is(1));
          assertThat(to.getMap().get(to.getName()), sameInstance(to));
          assertThat(to.getMap().size(), is(1));
          assertSame(to.getClazz(), List.class);
      }
  
  }