Source:
public void testIncorrectReplace ( ) throws java.io.IOException , javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException { com.android.sdklib.mock.MockLog mockLog = new com.android.sdklib.mock.MockLog ( ) ; java.lang.String main = "" + ( ( ( ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <application android:label=\"@string/lib_name\" />\n" ) + "\n" ) + " <activity android:name=\"activityOne\" " ) + " android:exported=\"false\"" ) + " tools:replace=\"exported\"/>\n" ) + "\n" ) + "</manifest>" ) ; java.lang.String library = "" + ( ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <application android:label=\"@string/lib_name\" />\n" ) + "\n" ) + " <activity android:name=\"activityOne\"/>" ) + "\n" ) + "</manifest>" ) ; com.android.manifmerger.XmlDocument mainDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "testIncorrectReplaceMain" ) , main ) ; com.android.manifmerger.XmlDocument libraryDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "testIncorrectReplaceLib" ) , library ) ; com.android.manifmerger.MergingReport.Builder mergingReportBuilder = new com.android.manifmerger.MergingReport.Builder ( mockLog ) ; mainDocument.merge ( libraryDocument , mergingReportBuilder ) ; com.android.manifmerger.PostValidator.validate ( mainDocument , mergingReportBuilder.getActionRecorder ( ) . build ( ) , mockLog ) ; for ( java.lang.String message : mockLog.getMessages ( ) ) { if ( ( ( message.charAt ( 0 ) ) == 'W' ) && ( message.contains ( "PostValidatorTest#testIncorrectReplaceMain:8" ) ) ) { return ; } } fail ( "No reference to faulty PostValidatorTest#testIncorrectRemoveMain:8 found" ) ; }

Target:
public void testIncorrectReplace ( ) throws java.io.IOException , javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException { java.lang.String main = "" + ( ( ( ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <application android:label=\"@string/lib_name\" />\n" ) + "\n" ) + " <activity android:name=\"activityOne\" " ) + " android:exported=\"false\"" ) + " tools:replace=\"exported\"/>\n" ) + "\n" ) + "</manifest>" ) ; java.lang.String library = "" + ( ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <application android:label=\"@string/lib_name\" />\n" ) + "\n" ) + " <activity android:name=\"activityOne\"/>" ) + "\n" ) + "</manifest>" ) ; com.android.manifmerger.XmlDocument mainDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "testIncorrectReplaceMain" ) , main ) ; com.android.manifmerger.XmlDocument libraryDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "testIncorrectReplaceLib" ) , library ) ; com.android.manifmerger.MergingReport.Builder mergingReportBuilder = new com.android.manifmerger.MergingReport.Builder ( mILogger ) ; mainDocument.merge ( libraryDocument , mergingReportBuilder ) ; com.android.manifmerger.PostValidator.validate ( mainDocument , mergingReportBuilder ) ; for ( com.android.manifmerger.MergingReport.Record record : mergingReportBuilder.build ( ) . getLoggingRecords ( ) ) { if ( ( ( record.getSeverity ( ) ) == ( MergingReport.Record.Severity.WARNING ) ) && ( record.toString ( ) . contains ( "PostValidatorTest#testIncorrectReplaceMain:8" ) ) ) { return ; } } fail ( "No reference to faulty PostValidatorTest#testIncorrectRemoveMain:8 found" ) ; }