### Question:
JAXBHelper { @Nullable public static <DATATYPE> JAXBElement <DATATYPE> getClonedJAXBElement (@Nullable final JAXBElement <DATATYPE> aObj) { if (aObj == null) return null; final DATATYPE aClonedValue = CloneHelper.getClonedValue (aObj.getValue ()); final JAXBElement <DATATYPE> ret = new JAXBElement <> (aObj.getName (), aObj.getDeclaredType (), aObj.getScope (), aClonedValue); ret.setNil (aObj.isNil ()); return ret; } private  JAXBHelper(); @Nullable static JAXBElement <DATATYPE> getClonedJAXBElement(@Nullable final JAXBElement <DATATYPE> aObj);  }### Answer:
@Test public void testCloneWithScope () { final JAXBElement <String> aJE = new JAXBElement <> (new QName ("urn:example.org", "test2"), String.class, JAXBHelperTest.class, "any"); final JAXBElement <String> aClone = JAXBHelper.getClonedJAXBElement (aJE); assertNotNull (aClone); assertNotSame (aJE, aClone); assertNotEquals (aJE, aClone); assertTrue (EqualsHelper.equals (aJE, aClone)); }
@Test public void testClone () { final JAXBElement <String> aJE = new JAXBElement <> (new QName ("urn:example.org", "test"), String.class, null, "any"); final JAXBElement <String> aClone = JAXBHelper.getClonedJAXBElement (aJE); assertNotNull (aClone); assertNotSame (aJE, aClone); assertNotEquals (aJE, aClone); assertTrue (EqualsHelper.equals (aJE, aClone)); }