### Question:
TransMetaJsonSerializer extends AbstractMetaJsonSerializer<TransMeta> { @Override protected void serializeSteps( TransMeta meta, JsonGenerator json ) throws IOException { json.writeArrayFieldStart( JSON_PROPERTY_STEPS ); for ( StepMeta stepMeta : meta.getSteps() ) { BaseStepMeta step = getBaseStepMetaFromStepMeta( stepMeta ); LineageRepository repo = getLineageRepository(); String id = stepMeta.getObjectId() == null ? stepMeta.getName() : stepMeta.getObjectId().toString(); ObjectId stepId = new StringObjectId( id ); try { step.saveRep( repo, null, null, stepId ); } catch ( KettleException e ) { LOGGER.warn( Messages.getString( "INFO.Serialization.Trans.Step", stepMeta.getName() ), e ); } json.writeObject( step ); } json.writeEndArray(); } TransMetaJsonSerializer( Class<TransMeta> aClass );  TransMetaJsonSerializer( JavaType javaType );  TransMetaJsonSerializer( Class<?> aClass, boolean b );   }### Answer:
@Test public void testSerializeSteps() throws Exception { final StepMeta spyStep1 = spy( new StepMeta() ); final StepMeta spyStep2 = spy( new StepMeta() ); final StepMeta spyStep3 = spy( new StepMeta() ); DummyTransMeta spyDummy1 = spy( new DummyTransMeta() ); DummyTransMeta spyDummy2 = spy( new DummyTransMeta() ); DummyTransMeta spyDummy3 = spy( new DummyTransMeta() ); List<StepMeta> steps = new ArrayList<StepMeta>() {{ add( spyStep1 ); add( spyStep2 ); add( spyStep3 ); }}; when( transMeta.getSteps() ).thenReturn( steps ); when( spyStep1.getStepMetaInterface() ).thenReturn( spyDummy1 ); when( spyStep2.getStepMetaInterface() ).thenReturn( spyDummy2 ); when( spyStep3.getStepMetaInterface() ).thenReturn( spyDummy3 ); doThrow( new KettleException() ).when( spyDummy3 ).saveRep( any( Repository.class ), any( IMetaStore.class ), any( ObjectId.class ), any( ObjectId.class ) ); serializer.serializeSteps( transMeta, json ); verify( json ).writeArrayFieldStart( TransMetaJsonSerializer.JSON_PROPERTY_STEPS ); verify( spyDummy1 ).saveRep( any( Repository.class ), any( IMetaStore.class ), any( ObjectId.class ), any( ObjectId.class ) ); verify( spyDummy2 ).saveRep( any( Repository.class ), any( IMetaStore.class ), any( ObjectId.class ), any( ObjectId.class ) ); verify( spyDummy3 ).saveRep( any( Repository.class ), any( IMetaStore.class ), any( ObjectId.class ), any( ObjectId.class ) ); verify( json ).writeObject( spyDummy1 ); verify( json ).writeObject( spyDummy2 ); verify( json ).writeObject( spyDummy3 ); }