Source:
public void testToolsAnnotationRemoval ( ) throws ManifestMerger2.MergeFailureException , 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 input = "" + ( ( ( ( ( ( ( ( "<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\" " ) + " tools:replace=\"label\"/>\n" ) + "\n" ) + "</manifest>" ) ; java.io.File tmpFile = com.android.manifmerger.ManifestMerger2SmallTest.inputAsFile ( "testToolsAnnotationRemoval" , input ) ; assertTrue ( tmpFile.exists ( ) ) ; try { com.android.manifmerger.MergingReport mergingReport = com.android.manifmerger.ManifestMerger2.newMerger ( tmpFile , mockLog , ManifestMerger2.MergeType.APPLICATION ) . merge ( ) ; assertEquals ( MergingReport.Result.WARNING , mergingReport.getResult ( ) ) ; com.android.manifmerger.XmlDocument mergedDocument = mergingReport.getMergedDocument ( ) . get ( ) ; com.google.common.base.Optional < com.android.manifmerger.XmlElement > applicationNode = mergedDocument.getByTypeAndKey ( ManifestModel.NodeTypes.APPLICATION , null ) ; assertTrue ( applicationNode.isPresent ( ) ) ; java.lang.String replaceAttribute = applicationNode.get ( ) . getXml ( ) . getAttributeNS ( SdkConstants.TOOLS_URI , "replace" ) ; assertTrue ( com.google.common.base.Strings.isNullOrEmpty ( replaceAttribute ) ) ; java.lang.System.out.println ( mergedDocument.prettyPrint ( ) ) ; mergedDocument.prettyPrint ( ) ; } finally { assertTrue ( tmpFile.delete ( ) ) ; } }

Target:
public void testToolsAnnotationRemoval ( ) throws ManifestMerger2.MergeFailureException , 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 input = "" + ( ( ( ( ( ( ( ( "<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\" " ) + " tools:replace=\"label\"/>\n" ) + "\n" ) + "</manifest>" ) ; java.io.File tmpFile = com.android.manifmerger.ManifestMerger2SmallTest.inputAsFile ( "testToolsAnnotationRemoval" , input ) ; assertTrue ( tmpFile.exists ( ) ) ; try { com.android.manifmerger.MergingReport mergingReport = com.android.manifmerger.ManifestMerger2.newMerger ( tmpFile , mockLog , ManifestMerger2.MergeType.APPLICATION ) . withFeatures ( ManifestMerger2.Invoker.Feature.REMOVE_TOOLS_DECLARATIONS ) . merge ( ) ; assertEquals ( MergingReport.Result.WARNING , mergingReport.getResult ( ) ) ; com.android.manifmerger.XmlDocument mergedDocument = mergingReport.getMergedDocument ( ) . get ( ) ; com.google.common.base.Optional < com.android.manifmerger.XmlElement > applicationNode = mergedDocument.getByTypeAndKey ( ManifestModel.NodeTypes.APPLICATION , null ) ; assertTrue ( applicationNode.isPresent ( ) ) ; java.lang.String replaceAttribute = applicationNode.get ( ) . getXml ( ) . getAttributeNS ( SdkConstants.TOOLS_URI , "replace" ) ; assertTrue ( com.google.common.base.Strings.isNullOrEmpty ( replaceAttribute ) ) ; java.lang.System.out.println ( mergedDocument.prettyPrint ( ) ) ; mergedDocument.prettyPrint ( ) ; } finally { assertTrue ( tmpFile.delete ( ) ) ; } }