private static String rootTestClassName(String originalClassName){
  int periodIndex=originalClassName.lastIndexOf('.');
  if (periodIndex != -1) {
    return originalClassName.substring(0,periodIndex) + ".generatedcode" + originalClassName.substring(periodIndex);
  }
 else {
    return "com.example.test.generatedcode.Test";
  }
}

private static String rootTestClassName ( String originalClassName ) { int periodIndex = originalClassName . lastIndexOf ( '.' ) ; if ( periodIndex != - 1 ) { return originalClassName . substring ( 0 , periodIndex ) + ".generatedcode" + originalClassName . substring ( periodIndex ) ; } else { return "com.example.test.generatedcode.Test" ; } }
creates a unique test class name . once no longer referenced , it can subsequently be reused , to keep compiler errors and stack traces cleaner .
