### Question:
MergeJoinMeta extends BaseTransformMeta implements ITransformMeta<MergeJoin, MergeJoinData> { public Object clone() { MergeJoinMeta retval = (MergeJoinMeta) super.clone(); int nrKeys1 = keyFields1.length; int nrKeys2 = keyFields2.length; retval.allocate( nrKeys1, nrKeys2 ); System.arraycopy( keyFields1, 0, retval.keyFields1, 0, nrKeys1 ); System.arraycopy( keyFields2, 0, retval.keyFields2, 0, nrKeys2 ); ITransformIOMeta transformIOMeta = new TransformIOMeta( true, true, false, false, false, false ); List<IStream> infoStreams = getTransformIOMeta().getInfoStreams(); for ( IStream infoStream : infoStreams ) { transformIOMeta.addStream( new Stream( infoStream ) ); } retval.setTransformIOMeta( transformIOMeta ); return retval; } MergeJoinMeta(); String getJoinType(); void setJoinType( String joinType ); String[] getKeyFields1(); void setKeyFields1( String[] keyFields1 ); String[] getKeyFields2(); void setKeyFields2( String[] keyFields2 ); boolean excludeFromRowLayoutVerification(); @Override MergeJoin createTransform(TransformMeta transformMeta, MergeJoinData data, int copyNr, PipelineMeta pipelineMeta, Pipeline pipeline); void loadXml( Node transformNode, IHopMetadataProvider metadataProvider ); void allocate( int nrKeys1, int nrKeys2 ); Object clone(); String getXml(); void setDefault(); @Override void searchInfoAndTargetTransforms( List<TransformMeta> transforms ); void check( List<ICheckResult> remarks, PipelineMeta pipelineMeta, TransformMeta transformMeta,
                     IRowMeta prev, String[] input, String[] output, IRowMeta info, IVariables variables,
                     IHopMetadataProvider metadataProvider ); void getFields( IRowMeta r, String name, IRowMeta[] info, TransformMeta nextTransform,
                         IVariables variables, IHopMetadataProvider metadataProvider ); ITransform getTransform(TransformMeta transformMeta, MergeJoinData data, int cnr, PipelineMeta tr,
                                 Pipeline pipeline ); MergeJoinData getTransformData(); ITransformIOMeta getTransformIOMeta(); void resetTransformIoMeta(); PipelineType[] getSupportedPipelineTypes(); static final String[] join_types; static final boolean[] one_optionals; static final boolean[] two_optionals; }### Answer:
@Test public void cloneTest() throws Exception { MergeJoinMeta meta = new MergeJoinMeta(); meta.allocate( 2, 3 ); meta.setKeyFields1( new String[] { "kf1-1", "kf1-2" } ); meta.setKeyFields2( new String[] { "kf2-1", "kf2-2", "kf2-3" } ); meta.setJoinType( "INNER" ); MergeJoinMeta aClone = (MergeJoinMeta) meta.clone(); assertFalse( aClone == meta ); assertTrue( Arrays.equals( meta.getKeyFields1(), aClone.getKeyFields1() ) ); assertTrue( Arrays.equals( meta.getKeyFields2(), aClone.getKeyFields2() ) ); assertEquals( meta.getJoinType(), aClone.getJoinType() ); assertNotNull( aClone.getTransformIOMeta() ); assertFalse( meta.getTransformIOMeta() == aClone.getTransformIOMeta() ); List<IStream> infoStreams = meta.getTransformIOMeta().getInfoStreams(); List<IStream> cloneInfoStreams = aClone.getTransformIOMeta().getInfoStreams(); assertFalse( infoStreams == cloneInfoStreams ); int streamSize = infoStreams.size(); assertTrue( streamSize == cloneInfoStreams.size() ); for ( int i = 0; i < streamSize; i++ ) { assertFalse( infoStreams.get( i ) == cloneInfoStreams.get( i ) ); } }