public String buildFilename() {

    boolean forceSameOutputFile = "Y".equalsIgnoreCase(
      System.getProperty( Const.KETTLE_JSON_OUTPUT_FORCE_SAME_OUTPUT_FILE, "N" ) );

    if ( forceSameOutputFile ) {
      return meta.buildFilename( environmentSubstitute( meta.getFileName() ), startProcessingDate );
    }

    return meta.buildFilename( meta.getParentStepMeta().getParentTransMeta(), getCopy() + "", null, data.splitnr + "",
      false );
  }
@Test
  public void testBuildFilenameWithoutForceSameOutputFile() {

    StepMeta stepMeta = mock( StepMeta.class );
    JsonOutputData jsonOutputData = mock( JsonOutputData.class );
    JsonOutputMeta jsonOutputMeta = mock( JsonOutputMeta.class );
    int copyNr = 1;
    TransMeta transMeta = mock( TransMeta.class );
    Trans trans = mock( Trans.class );
    RowMetaInterface rowMetaInterface = mock( RowMetaInterface.class );

    when( stepMeta.getName() ).thenReturn( UUID.randomUUID().toString() );
    when( stepMeta.hasTerminator() ).thenReturn( false );
    when( transMeta.findStep( any( String.class ) ) ).thenReturn( stepMeta );
    when( stepMeta.getStepMetaInterface() ).thenReturn( jsonOutputMeta );
    when( jsonOutputMeta.getParentStepMeta() ).thenReturn( stepMeta );

    JsonOutput jsonOutput = spy( new JsonOutput( stepMeta, jsonOutputData, copyNr, transMeta, trans ) );
    ReflectionTestUtils.setField( jsonOutput, "meta", jsonOutputMeta );
    ReflectionTestUtils.setField( jsonOutput, "data", jsonOutputData );

    System.setProperty( Const.KETTLE_JSON_OUTPUT_FORCE_SAME_OUTPUT_FILE, "N" );
    jsonOutput.buildFilename();

    verify( jsonOutputMeta, times( 0 ) ).buildFilename( anyString(), any( Date.class ) );
  }