### Question:
JsonMerger { public Map<String, Object> clone( Map<String, ?> jsonObject ) { return cloneMap( jsonObject ); }  Map<String, Object> merge( Map<String, ?> object1, Map<String, ?> object2 ); List<Object> merge( List<?> array1, List<?> array2 ); Map<String, Object> clone( Map<String, ?> jsonObject ); List<Object> clone( List<?> array );  }### Answer:
@Test public void cloneObjectSimpleValues() { Map<String, Object> obj1 = new HashMap<>(); obj1.put( "a", 1 ); obj1.put( "b", 2 ); obj1.put( "c", 3 ); Map<String, Object> result = this.merger.clone( obj1 ); assertNotSame( obj1, result ); assertEquals( obj1, result ); }
@Test public void cloneListSimpleValues() { List<Object> obj1 = new ArrayList<>(); obj1.add( 1 ); obj1.add( 2 ); obj1.add( 3 ); List<Object> result = this.merger.clone( obj1 ); assertNotSame( obj1, result ); assertEquals( obj1, result ); }
@Test public void cloneObjectComplexValues() { Map<String, Object> obj1 = new HashMap<>(); obj1.put( "a", createObject() ); Map<String, Object> result = this.merger.clone( obj1 ); assertNotSame( obj1, result ); assertEquals( obj1, result ); assertNotSame( obj1.get( "a" ), result.get( "a" ) ); assertEquals( obj1.get( "a" ), result.get( "a" ) ); }
@Test public void cloneListComplexValues() { List<Object> obj1 = new ArrayList<>(); obj1.add( createObject() ); List<Object> result = this.merger.clone( obj1 ); assertNotSame( obj1, result ); assertEquals( obj1, result ); assertNotSame( obj1.get( 0 ), result.get( 0 ) ); assertEquals( obj1.get( 0 ), result.get( 0 ) ); }
@Test public void cloneObjectListValues() { Map<String, Object> obj1 = new HashMap<>(); obj1.put( "a", createList() ); Map<String, Object> result = this.merger.clone( obj1 ); assertNotSame( obj1, result ); assertEquals( obj1, result ); assertNotSame( obj1.get( "a" ), result.get( "a" ) ); assertEquals( obj1.get( "a" ), result.get( "a" ) ); }
@Test public void cloneListListValues() { List<Object> obj1 = new ArrayList<>(); obj1.add( createList() ); List<Object> result = this.merger.clone( obj1 ); assertNotSame( obj1, result ); assertEquals( obj1, result ); assertNotSame( obj1.get( 0 ), result.get( 0 ) ); assertEquals( obj1.get( 0 ), result.get( 0 ) ); }