Source:
public void testOverridingSystemProperties ( ) throws java.io.IOException , javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException { java.lang.String xml = "" + ( ( ( ( "<manifest versionCode=\"34\" versionName=\"3.4\"\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\">\n" ) + " <uses-sdk minSdkVersion=\"9\" targetSdkVersion=\".9\"/>\n" ) + " <activity android:name=\"activityOne\"/>\n" ) + "</manifest>" ) ; com.android.manifmerger.XmlDocument document = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "testAddingSystemProperties#xml" ) , xml ) ; assertEquals ( "34" , document.getXml ( ) . getDocumentElement ( ) . getAttribute ( "versionCode" ) ) ; assertEquals ( "3.4" , document.getXml ( ) . getDocumentElement ( ) . getAttribute ( "versionName" ) ) ; org.w3c.dom.Element usesSdk = ( ( org.w3c.dom.Element ) ( document.getXml ( ) . getElementsByTagName ( "uses-sdk" ) . item ( 0 ) ) ) ; assertNotNull ( usesSdk ) ; assertEquals ( "9" , usesSdk.getAttribute ( "minSdkVersion" ) ) ; assertEquals ( ".9" , usesSdk.getAttribute ( "targetSdkVersion" ) ) ; ManifestMerger2.SystemProperty.VERSION_CODE.addTo ( document.getXml ( ) , "101" ) ; assertEquals ( "101" , document.getXml ( ) . getDocumentElement ( ) . getAttribute ( "android:versionCode" ) ) ; ManifestMerger2.SystemProperty.VERSION_NAME.addTo ( document.getXml ( ) , "1.0.1" ) ; assertEquals ( "1.0.1" , document.getXml ( ) . getDocumentElement ( ) . getAttribute ( "android:versionName" ) ) ; ManifestMerger2.SystemProperty.MIN_SDK_VERSION.addTo ( document.getXml ( ) , "10" ) ; usesSdk = ( ( org.w3c.dom.Element ) ( document.getXml ( ) . getElementsByTagName ( "uses-sdk" ) . item ( 0 ) ) ) ; assertNotNull ( usesSdk ) ; assertEquals ( "10" , usesSdk.getAttribute ( "android:minSdkVersion" ) ) ; ManifestMerger2.SystemProperty.TARGET_SDK_VERSION.addTo ( document.getXml ( ) , "14" ) ; usesSdk = ( ( org.w3c.dom.Element ) ( document.getXml ( ) . getElementsByTagName ( "uses-sdk" ) . item ( 0 ) ) ) ; assertNotNull ( usesSdk ) ; assertEquals ( "14" , usesSdk.getAttribute ( "android:targetSdkVersion" ) ) ; }

Target:
public void testOverridingSystemProperties ( ) throws java.io.IOException , javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException { java.lang.String xml = "" + ( ( ( ( "<manifest versionCode=\"34\" versionName=\"3.4\"\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\">\n" ) + " <uses-sdk minSdkVersion=\"9\" targetSdkVersion=\".9\"/>\n" ) + " <activity android:name=\"activityOne\"/>\n" ) + "</manifest>" ) ; com.android.manifmerger.XmlDocument document = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "testAddingSystemProperties#xml" ) , xml ) ; assertEquals ( "34" , document.getXml ( ) . getDocumentElement ( ) . getAttribute ( "versionCode" ) ) ; assertEquals ( "3.4" , document.getXml ( ) . getDocumentElement ( ) . getAttribute ( "versionName" ) ) ; org.w3c.dom.Element usesSdk = ( ( org.w3c.dom.Element ) ( document.getXml ( ) . getElementsByTagName ( "uses-sdk" ) . item ( 0 ) ) ) ; assertNotNull ( usesSdk ) ; assertEquals ( "9" , usesSdk.getAttribute ( "minSdkVersion" ) ) ; assertEquals ( ".9" , usesSdk.getAttribute ( "targetSdkVersion" ) ) ; ManifestMerger2.SystemProperty.VERSION_CODE.addTo ( mActionRecorder , document , "101" ) ; assertEquals ( "101" , document.getXml ( ) . getDocumentElement ( ) . getAttribute ( "android:versionCode" ) ) ; ManifestMerger2.SystemProperty.VERSION_NAME.addTo ( mActionRecorder , document , "1.0.1" ) ; assertEquals ( "1.0.1" , document.getXml ( ) . getDocumentElement ( ) . getAttribute ( "android:versionName" ) ) ; ManifestMerger2.SystemProperty.MIN_SDK_VERSION.addTo ( mActionRecorder , document , "10" ) ; usesSdk = ( ( org.w3c.dom.Element ) ( document.getXml ( ) . getElementsByTagName ( "uses-sdk" ) . item ( 0 ) ) ) ; assertNotNull ( usesSdk ) ; assertEquals ( "10" , usesSdk.getAttribute ( "android:minSdkVersion" ) ) ; ManifestMerger2.SystemProperty.TARGET_SDK_VERSION.addTo ( mActionRecorder , document , "14" ) ; usesSdk = ( ( org.w3c.dom.Element ) ( document.getXml ( ) . getElementsByTagName ( "uses-sdk" ) . item ( 0 ) ) ) ; assertNotNull ( usesSdk ) ; assertEquals ( "14" , usesSdk.getAttribute ( "android:targetSdkVersion" ) ) ; }