### Question:
MergeJoinMeta extends BaseStepMeta implements StepMetaInterface { 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 ); StepIOMetaInterface stepIOMeta = new StepIOMeta( true, true, false, false, false, false ); List<StreamInterface> infoStreams = getStepIOMeta().getInfoStreams(); for ( StreamInterface infoStream : infoStreams ) { stepIOMeta.addStream( new Stream( infoStream ) ); } retval.ioMeta = stepIOMeta; return retval; } MergeJoinMeta(); String getJoinType(); void setJoinType( String joinType ); String[] getKeyFields1(); void setKeyFields1( String[] keyFields1 ); String[] getKeyFields2(); void setKeyFields2( String[] keyFields2 ); boolean excludeFromRowLayoutVerification(); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrKeys1, int nrKeys2 ); Object clone(); String getXML(); void setDefault(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); @Override void searchInfoAndTargetSteps( List<StepMeta> steps ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
                     RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
                     Repository repository, IMetaStore metaStore ); void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep,
                         VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr,
                                Trans trans ); StepDataInterface getStepData(); StepIOMetaInterface getStepIOMeta(); void resetStepIoMeta(); TransformationType[] getSupportedTransformationTypes(); 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.getStepIOMeta() ); assertFalse( meta.getStepIOMeta() == aClone.getStepIOMeta() ); List<StreamInterface> infoStreams = meta.getStepIOMeta().getInfoStreams(); List<StreamInterface> cloneInfoStreams = aClone.getStepIOMeta().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 ) ); } }