AbstractFlexFile implements IFlexFile { protected static String computePackageName( final String filePath, final CharSequence rootPath, final String className, final String fileSeparator ) { String temporaryPackage; temporaryPackage = filePath.replace( className, "" ).replace( rootPath, "" ).replace( fileSeparator, "." ); if ( temporaryPackage.endsWith( "." ) ) { temporaryPackage = temporaryPackage.substring( 0, temporaryPackage.length() - 1 ); } if ( temporaryPackage.length() > 0 && temporaryPackage.charAt( 0 ) == '.' ) { temporaryPackage = temporaryPackage.substring( 1, temporaryPackage.length() ); } return temporaryPackage; } protected  AbstractFlexFile( final File underlyingFile,
                               final File rootDirectory ); final boolean contains( final String stringToLookup,
                                  final Set< Integer > linesToBeIgnored ); @Override final boolean equals( final Object obj ); final String getClassName(); abstract String getCommentClosingTag(); abstract String getCommentOpeningTag(); final String getFilename(); final String getFilePath(); final String getFullyQualifiedName(); String getLineAt( final int lineIndex ); final List< String > getLines(); int getLinesNb(); final String getPackageName(); @Override int hashCode(); abstract boolean isMainApplication(); abstract boolean isMxml();  }
@Test public void testFlexPMD152() { Assert.assertEquals( "com.something", AbstractFlexFile.computePackageName( "C:/somePath/ProjectName/com/something/Test.mxml", "C:/somePath/ProjectName", "Test.mxml", "/" ) ); Assert.assertEquals( "com.something", AbstractFlexFile.computePackageName( "C:/somePath/ProjectName/com/something/Test.mxml", "C:/somePath/ProjectName/", "Test.mxml", "/" ) ); }