Source:
public void testElementReplacement ( ) throws java.io.IOException , javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException { java.lang.String higherPriority = "" + ( ( ( ( ( ( ( ( "<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" ) + " <activity android:name=\"activityOne\" tools:node=\"replace\"" ) + " android:exported=\"true\"/>\n" ) + "\n" ) + "</manifest>" ) ; java.lang.String lowerPriority = "" + ( ( ( ( ( ( ( ( ( ( "<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" ) + " <activity android:name=\"activityOne\">\n" ) + " android:screenOrientation=\"landscape\">\n" ) + " <action android:label=\"@string/foo\"/>\n" ) + " </activity>\n" ) + "\n" ) + "</manifest>" ) ; com.android.manifmerger.XmlDocument refDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "higherPriority" ) , higherPriority ) ; com.android.manifmerger.XmlDocument otherDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "lowerPriority" ) , lowerPriority ) ; com.android.manifmerger.MergingReport.Builder mergingReportBuilder = new com.android.manifmerger.MergingReport.Builder ( new com.android.utils.StdLogger ( StdLogger.Level.VERBOSE ) ) ; com.google.common.base.Optional < com.android.manifmerger.XmlDocument > result = refDocument.merge ( otherDocument , mergingReportBuilder ) ; assertTrue ( result.isPresent ( ) ) ; com.android.manifmerger.XmlDocument resultDocument = result.get ( ) ; com.google.common.base.Optional < com.android.manifmerger.XmlElement > activityOne = resultDocument.getRootNode ( ) . getNodeByTypeAndKey ( ManifestModel.NodeTypes.ACTIVITY , "com.example.lib3.activityOne" ) ; assertTrue ( activityOne.isPresent ( ) ) ; java.io.ByteArrayOutputStream byteArrayOutputStream = new java.io.ByteArrayOutputStream ( ) ; resultDocument.write ( byteArrayOutputStream ) ; java.util.logging.Logger.getAnonymousLogger ( ) . info ( byteArrayOutputStream.toString ( ) ) ; assertFalse ( refDocument.getRootNode ( ) . getNodeByTypeAndKey ( ManifestModel.NodeTypes.ACTIVITY , "com.example.lib3.activityOne" ) . get ( ) . compareTo ( activityOne.get ( ) ) . isPresent ( ) ) ; }

Target:
public void testElementReplacement ( ) throws java.io.IOException , javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException { java.lang.String higherPriority = "" + ( ( ( ( ( ( ( ( "<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" ) + " <activity android:name=\"activityOne\" tools:node=\"replace\"" ) + " android:exported=\"true\"/>\n" ) + "\n" ) + "</manifest>" ) ; java.lang.String lowerPriority = "" + ( ( ( ( ( ( ( ( ( ( "<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" ) + " <activity android:name=\"activityOne\">\n" ) + " android:screenOrientation=\"landscape\">\n" ) + " <action android:label=\"@string/foo\"/>\n" ) + " </activity>\n" ) + "\n" ) + "</manifest>" ) ; com.android.manifmerger.XmlDocument refDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "higherPriority" ) , higherPriority ) ; com.android.manifmerger.XmlDocument otherDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "lowerPriority" ) , lowerPriority ) ; com.android.manifmerger.MergingReport.Builder mergingReportBuilder = new com.android.manifmerger.MergingReport.Builder ( new com.android.utils.StdLogger ( StdLogger.Level.VERBOSE ) ) ; com.google.common.base.Optional < com.android.manifmerger.XmlDocument > result = refDocument.merge ( otherDocument , mergingReportBuilder ) ; assertTrue ( result.isPresent ( ) ) ; com.android.manifmerger.XmlDocument resultDocument = result.get ( ) ; com.google.common.base.Optional < com.android.manifmerger.XmlElement > activityOne = resultDocument.getRootNode ( ) . getNodeByTypeAndKey ( ManifestModel.NodeTypes.ACTIVITY , "com.example.lib3.activityOne" ) ; assertTrue ( activityOne.isPresent ( ) ) ; java.util.logging.Logger.getAnonymousLogger ( ) . info ( resultDocument.prettyPrint ( ) ) ; assertFalse ( refDocument.getRootNode ( ) . getNodeByTypeAndKey ( ManifestModel.NodeTypes.ACTIVITY , "com.example.lib3.activityOne" ) . get ( ) . compareTo ( activityOne.get ( ) ) . isPresent ( ) ) ; }