Source:
public void testPlaceholders ( ) throws java.io.IOException , javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException { java.lang.String xml = "" + ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\">\n" ) + " <activity android:name=\"activityOne\"\n" ) + " android:attr1=\"${landscapePH}\"\n" ) + " android:attr2=\"prefix.${landscapePH}\"\n" ) + " android:attr3=\"${landscapePH}.suffix\"\n" ) + " android:attr4=\"prefix${landscapePH}suffix\">\n" ) + " </activity>\n" ) + "</manifest>" ) ; com.android.manifmerger.XmlDocument refDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "testPlaceholders#xml" ) , xml ) ; com.android.manifmerger.PlaceholderHandler handler = new com.android.manifmerger.PlaceholderHandler ( ) ; handler.visit ( refDocument , new com.android.manifmerger.PlaceholderHandler.KeyBasedValueResolver < java.lang.String > ( ) { @ java.lang.Override public java.lang.String getValue ( @ com.android.annotations.NonNull java.lang.String key ) { return "newValue" ; } } , mBuilder ) ; com.google.common.base.Optional < com.android.manifmerger.XmlElement > activityOne = refDocument.getRootNode ( ) . getNodeByTypeAndKey ( ManifestModel.NodeTypes.ACTIVITY , ".activityOne" ) ; assertTrue ( activityOne.isPresent ( ) ) ; assertEquals ( 5 , activityOne.get ( ) . getAttributes ( ) . size ( ) ) ; assertEquals ( "newValue" , activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:attr1" ) ) . get ( ) . getValue ( ) ) ; assertEquals ( "prefix.newValue" , activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:attr2" ) ) . get ( ) . getValue ( ) ) ; assertEquals ( "newValue.suffix" , activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:attr3" ) ) . get ( ) . getValue ( ) ) ; assertEquals ( "prefixnewValuesuffix" , activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:attr4" ) ) . get ( ) . getValue ( ) ) ; for ( com.android.manifmerger.XmlAttribute xmlAttribute : activityOne.get ( ) . getAttributes ( ) ) { if ( ! ( xmlAttribute.getName ( ) . toString ( ) . contains ( "name" ) ) ) { org.mockito.Mockito.verify ( mActionRecorder ) . recordAttributeAction ( xmlAttribute , PositionImpl.UNKNOWN , Actions.ActionType.INJECTED , null ) ; } } }

Target:
public void testPlaceholders ( ) throws java.io.IOException , javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException { java.lang.String xml = "" + ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\">\n" ) + " <activity android:name=\"activityOne\"\n" ) + " android:attr1=\"${landscapePH}\"\n" ) + " android:attr2=\"prefix.${landscapePH}\"\n" ) + " android:attr3=\"${landscapePH}.suffix\"\n" ) + " android:attr4=\"prefix${landscapePH}suffix\">\n" ) + " </activity>\n" ) + "</manifest>" ) ; com.android.manifmerger.XmlDocument refDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "testPlaceholders#xml" ) , xml ) ; com.android.manifmerger.PlaceholderHandler handler = new com.android.manifmerger.PlaceholderHandler ( ) ; handler.visit ( ManifestMerger2.MergeType.APPLICATION , refDocument , new com.android.manifmerger.PlaceholderHandler.KeyBasedValueResolver < java.lang.String > ( ) { @ java.lang.Override public java.lang.String getValue ( @ com.android.annotations.NonNull java.lang.String key ) { return "newValue" ; } } , mBuilder ) ; com.google.common.base.Optional < com.android.manifmerger.XmlElement > activityOne = refDocument.getRootNode ( ) . getNodeByTypeAndKey ( ManifestModel.NodeTypes.ACTIVITY , ".activityOne" ) ; assertTrue ( activityOne.isPresent ( ) ) ; assertEquals ( 5 , activityOne.get ( ) . getAttributes ( ) . size ( ) ) ; assertEquals ( "newValue" , activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:attr1" ) ) . get ( ) . getValue ( ) ) ; assertEquals ( "prefix.newValue" , activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:attr2" ) ) . get ( ) . getValue ( ) ) ; assertEquals ( "newValue.suffix" , activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:attr3" ) ) . get ( ) . getValue ( ) ) ; assertEquals ( "prefixnewValuesuffix" , activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:attr4" ) ) . get ( ) . getValue ( ) ) ; for ( com.android.manifmerger.XmlAttribute xmlAttribute : activityOne.get ( ) . getAttributes ( ) ) { if ( ! ( xmlAttribute.getName ( ) . toString ( ) . contains ( "name" ) ) ) { org.mockito.Mockito.verify ( mActionRecorder ) . recordAttributeAction ( xmlAttribute , PositionImpl.UNKNOWN , Actions.ActionType.INJECTED , null ) ; } } }