@VisibleForTesting
  protected List<UserDefinedJavaClassDef> orderDefinitions( List<UserDefinedJavaClassDef> definitions ) {
    List<UserDefinedJavaClassDef> orderedDefinitions = new ArrayList<>( definitions.size() );
    List<UserDefinedJavaClassDef> transactions =
      definitions.stream()
        .filter( def -> def.isTransformClass() && def.isActive() )
        .sorted( ( p1, p2 ) -> p1.getClassName().compareTo( p2.getClassName() ) )
        .collect( Collectors.toList() );

    List<UserDefinedJavaClassDef> normalClasses =
      definitions.stream()
        .filter( def -> !def.isTransformClass() )
        .sorted( ( p1, p2 ) -> p1.getClassName().compareTo( p2.getClassName() ) )
        .collect( Collectors.toList() );

    orderedDefinitions.addAll( normalClasses );
    orderedDefinitions.addAll( transactions );
    return orderedDefinitions;
  }
@Test
  public void oderDefinitionTest() throws Exception {
    String codeBlock1 = "public boolean processRow() {\n"
      + "    return true;\n"
      + "}\n\n";
    String codeBlock2 = "public boolean extraClassA() {\n"
      + "    // Random comment\n"
      + "    return true;\n"
      + "}\n\n";
    String codeBlock3 = "public boolean extraClassB() {\n"
      + "    // Random comment\n"
      + "    return true;\n"
      + "}\n\n";
    UserDefinedJavaClassMeta userDefinedJavaClassMeta = new UserDefinedJavaClassMeta();
    UserDefinedJavaClassDef processClassDef = new UserDefinedJavaClassDef( UserDefinedJavaClassDef.ClassType.TRANSFORM_CLASS, "Process", codeBlock1 );
    UserDefinedJavaClassDef processClassDefA = new UserDefinedJavaClassDef( UserDefinedJavaClassDef.ClassType.TRANSFORM_CLASS, "ProcessA", codeBlock1 );
    UserDefinedJavaClassDef normalClassADef = new UserDefinedJavaClassDef( UserDefinedJavaClassDef.ClassType.NORMAL_CLASS, "A", codeBlock1 );
    UserDefinedJavaClassDef normalClassBDef = new UserDefinedJavaClassDef( UserDefinedJavaClassDef.ClassType.NORMAL_CLASS, "B", codeBlock1 );
    UserDefinedJavaClassDef normalClassCDef = new UserDefinedJavaClassDef( UserDefinedJavaClassDef.ClassType.NORMAL_CLASS, "C", codeBlock1 );

    ArrayList<UserDefinedJavaClassDef> defs = new ArrayList<>(5);
    defs.add(processClassDefA);
    defs.add(processClassDef);
    defs.add(normalClassCDef);
    defs.add(normalClassBDef);
    defs.add(normalClassADef);

    StepMeta stepMeta = Mockito.mock( StepMeta.class );
    Mockito.when( stepMeta.getName() ).thenReturn( "User Defined Java Class" );
    userDefinedJavaClassMeta.setParentStepMeta( stepMeta );

    // Test reording the reverse order test
    List<UserDefinedJavaClassDef> orderDefs = userDefinedJavaClassMeta.orderDefinitions( defs );
    Assert.assertTrue( orderDefs.get(0).getClassName().equals( "A" ) );
    Assert.assertTrue( orderDefs.get(1).getClassName().equals( "B" ) );
    Assert.assertTrue( orderDefs.get(2).getClassName().equals( "C" ) );
    Assert.assertTrue( orderDefs.get(3).getClassName().equals( "Process" ) );
    Assert.assertTrue( orderDefs.get(4).getClassName().equals( "ProcessA" ) );


    // Random order test
    defs.clear();
    defs.add(normalClassADef);
    defs.add(normalClassCDef);
    defs.add(processClassDefA);
    defs.add(normalClassBDef);
    defs.add(processClassDef);
    orderDefs = userDefinedJavaClassMeta.orderDefinitions( defs );
    Assert.assertTrue( orderDefs.get(0).getClassName().equals( "A" ) );
    Assert.assertTrue( orderDefs.get(1).getClassName().equals( "B" ) );
    Assert.assertTrue( orderDefs.get(2).getClassName().equals( "C" ) );
    Assert.assertTrue( orderDefs.get(3).getClassName().equals( "Process" ) );
    Assert.assertTrue( orderDefs.get(4).getClassName().equals( "ProcessA" ) );
  }