### Question:
GeneratingTransformations { public TransMeta generateTransformation() { try { System.out.println( "Generating a transformation definition" ); TransMeta transMeta = new TransMeta(); transMeta.setName( "Generated Demo Transformation" ); PluginRegistry registry = PluginRegistry.getInstance(); System.out.println( "- Adding Row Generator Step" ); RowGeneratorMeta rowGeneratorMeta = new RowGeneratorMeta(); String rowGeneratorPluginId = registry.getPluginId( StepPluginType.class, rowGeneratorMeta ); rowGeneratorMeta.setRowLimit( "5" ); rowGeneratorMeta.allocate( 2 ); rowGeneratorMeta.setFieldName( new String[] { "field_1", "field_2" } ); rowGeneratorMeta.setFieldType( new String[] { "String", "Integer" } ); rowGeneratorMeta.setValue( new String[] { "Hello World", "100" } ); StepMeta rowGeneratorStepMeta = new StepMeta( rowGeneratorPluginId, "Generate Some Rows", rowGeneratorMeta ); rowGeneratorStepMeta.setDraw( true ); rowGeneratorStepMeta.setLocation( 100, 100 ); transMeta.addStep( rowGeneratorStepMeta ); System.out.println( "- Adding Add Sequence Step" ); AddSequenceMeta addSequenceMeta = new AddSequenceMeta(); String addSequencePluginId = registry.getPluginId( StepPluginType.class, addSequenceMeta ); addSequenceMeta.setDefault(); addSequenceMeta.setValuename( "counter" ); addSequenceMeta.setCounterName( "counter_1" ); addSequenceMeta.setStartAt( 1 ); addSequenceMeta.setMaxValue( Long.MAX_VALUE ); addSequenceMeta.setIncrementBy( 1 ); StepMeta addSequenceStepMeta = new StepMeta( addSequencePluginId, "Add Counter Field", addSequenceMeta ); addSequenceStepMeta.setDraw( true ); addSequenceStepMeta.setLocation( 300, 100 ); transMeta.addStep( addSequenceStepMeta ); transMeta.addTransHop( new TransHopMeta( rowGeneratorStepMeta, addSequenceStepMeta ) ); System.out.println( "- Adding Dummy Step" ); DummyTransMeta dummyMeta = new DummyTransMeta(); String dummyPluginId = registry.getPluginId( StepPluginType.class, dummyMeta ); StepMeta dummyStepMeta = new StepMeta( dummyPluginId, "Dummy", dummyMeta ); dummyStepMeta.setDraw( true ); dummyStepMeta.setLocation( 500, 100 ); transMeta.addStep( dummyStepMeta ); transMeta.addTransHop( new TransHopMeta( addSequenceStepMeta, dummyStepMeta ) ); return transMeta; } catch ( Exception e ) { e.printStackTrace(); return null; } }  static void main( String[] args ); TransMeta generateTransformation(); static GeneratingTransformations instance; }### Answer:
@Test public void testGeneratedTransform() throws KettleException{ GeneratingTransformations instance = new GeneratingTransformations(); TransMeta transMeta = instance.generateTransformation(); assertEquals(transMeta.getName(), "Generated Demo Transformation"); assertEquals(transMeta.getSteps().size(), 3); }