aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools
diff options
context:
space:
mode:
authorGravatar jcater <jcater@google.com>2018-05-01 14:38:42 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-05-01 14:40:49 -0700
commit1f1c0e6a4c441e2c7378fec8623b994f54238c7c (patch)
treee18607b2455d5ec10f244b1d157a0fa9d857c714 /src/test/java/com/google/devtools
parentcecb3a8887eec0bdd07fadf36d7f8a181801c6bd (diff)
Clean up code that directly imports nested classes like Builder, Entry, etc.
PiperOrigin-RevId: 194999124
Diffstat (limited to 'src/test/java/com/google/devtools')
-rw-r--r--src/test/java/com/google/devtools/build/android/AarGeneratorActionTest.java5
-rw-r--r--src/test/java/com/google/devtools/build/android/AndroidDataBuilder.java7
-rw-r--r--src/test/java/com/google/devtools/build/android/AndroidDataMergerTest.java159
-rw-r--r--src/test/java/com/google/devtools/build/android/DataResourceXmlTest.java51
-rw-r--r--src/test/java/com/google/devtools/build/android/ManifestMergerActionTest.java5
-rw-r--r--src/test/java/com/google/devtools/build/android/ParsedAndroidDataSubject.java6
6 files changed, 150 insertions, 83 deletions
diff --git a/src/test/java/com/google/devtools/build/android/AarGeneratorActionTest.java b/src/test/java/com/google/devtools/build/android/AarGeneratorActionTest.java
index 6d1729769d..ae40dd3592 100644
--- a/src/test/java/com/google/devtools/build/android/AarGeneratorActionTest.java
+++ b/src/test/java/com/google/devtools/build/android/AarGeneratorActionTest.java
@@ -37,7 +37,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
@@ -184,7 +183,7 @@ public class AarGeneratorActionTest {
if (withEmptyAssets) {
Files.createDirectories(assetDir);
}
- for (Entry<Path, String> entry : filesToWrite.entrySet()) {
+ for (Map.Entry<Path, String> entry : filesToWrite.entrySet()) {
Path file = entry.getKey();
// only write files in assets if assets has not been set to empty and same for resources
if (!((file.startsWith(assetDir) && withEmptyAssets)
@@ -202,7 +201,7 @@ public class AarGeneratorActionTest {
private void writeClassesJar() throws IOException {
final ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(classes.toFile()));
- for (Entry<String, String> file : classesToWrite.entrySet()) {
+ for (Map.Entry<String, String> file : classesToWrite.entrySet()) {
ZipEntry entry = new ZipEntry(file.getKey());
zout.putNextEntry(entry);
zout.write(file.getValue().getBytes(UTF_8));
diff --git a/src/test/java/com/google/devtools/build/android/AndroidDataBuilder.java b/src/test/java/com/google/devtools/build/android/AndroidDataBuilder.java
index 5e64ef4b9b..7e55e3e37d 100644
--- a/src/test/java/com/google/devtools/build/android/AndroidDataBuilder.java
+++ b/src/test/java/com/google/devtools/build/android/AndroidDataBuilder.java
@@ -25,7 +25,6 @@ import java.nio.file.StandardCopyOption;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
/**
* Utility for building {@link UnvalidatedAndroidData}, {@link ParsedAndroidData},
@@ -99,7 +98,7 @@ public class AndroidDataBuilder {
public AndroidDataBuilder addValuesWithAttributes(
String path, Map<String, String> attributes, String... lines) {
ImmutableList.Builder<String> attributeBuilder = ImmutableList.builder();
- for (Entry<String, String> attribute : attributes.entrySet()) {
+ for (Map.Entry<String, String> attribute : attributes.entrySet()) {
if (attribute.getKey() != null && attribute.getValue() != null) {
attributeBuilder.add(String.format("%s=\"%s\"", attribute.getKey(), attribute.getValue()));
}
@@ -173,12 +172,12 @@ public class AndroidDataBuilder {
Files.createDirectories(assetDir);
Files.createDirectories(resourceDir);
Preconditions.checkNotNull(manifest, "A manifest is required.");
- for (Entry<Path, String> entry : filesToWrite.entrySet()) {
+ for (Map.Entry<Path, String> entry : filesToWrite.entrySet()) {
Files.createDirectories(entry.getKey().getParent());
Files.write(entry.getKey(), entry.getValue().getBytes(StandardCharsets.UTF_8));
Preconditions.checkArgument(Files.exists(entry.getKey()));
}
- for (Entry<Path, Path> entry : filesToCopy.entrySet()) {
+ for (Map.Entry<Path, Path> entry : filesToCopy.entrySet()) {
Path target = entry.getKey();
Path source = entry.getValue();
Files.createDirectories(target.getParent());
diff --git a/src/test/java/com/google/devtools/build/android/AndroidDataMergerTest.java b/src/test/java/com/google/devtools/build/android/AndroidDataMergerTest.java
index 80bf3386b1..422eac18ba 100644
--- a/src/test/java/com/google/devtools/build/android/AndroidDataMergerTest.java
+++ b/src/test/java/com/google/devtools/build/android/AndroidDataMergerTest.java
@@ -29,7 +29,6 @@ import com.google.devtools.build.android.AndroidDataMerger.SourceChecker;
import com.google.devtools.build.android.xml.IdXmlResourceValue;
import com.google.devtools.build.android.xml.PublicXmlResourceValue;
import com.google.devtools.build.android.xml.SimpleXmlResourceValue;
-import com.google.devtools.build.android.xml.SimpleXmlResourceValue.Type;
import com.google.devtools.build.android.xml.StyleableXmlResourceValue;
import java.io.IOException;
import java.nio.file.FileSystem;
@@ -88,7 +87,9 @@ public class AndroidDataMergerTest {
file("layout/exit").source("res/layout/exit.xml"),
xml("string/exit")
.source(directStrings)
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")))
.combining(xml("id/exit").source("values/ids.xml").value(IdXmlResourceValue.of()))
.build();
@@ -111,7 +112,9 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source(primaryStrings.overwrite(directStrings))
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "way out")))
.build(),
ParsedAndroidDataBuilder.buildOn(fqnFactory)
.overwritable(file("layout/exit").root(directRoot).source("res/layout/exit.xml"))
@@ -147,7 +150,9 @@ public class AndroidDataMergerTest {
file("layout/exit").source("res/layout/exit.xml"),
xml("string/exit")
.source(directString)
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")))
.combining(xml("id/exit").source("values/ids.xml").value(IdXmlResourceValue.of()))
.build();
@@ -171,7 +176,9 @@ public class AndroidDataMergerTest {
xml("string/exit")
.root(primaryRoot)
.source(primaryString.overwrite(directString))
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "way out")))
.build(),
ParsedAndroidDataBuilder.buildOn(fqnFactory)
.overwritable(
@@ -212,7 +219,9 @@ public class AndroidDataMergerTest {
file("layout/exit").source("res/layout/exit.xml"),
xml("string/exit")
.source(directStrings)
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")))
.combining(xml("id/exit").source("values/ids.xml").value(IdXmlResourceValue.of()))
.build();
@@ -235,7 +244,9 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source(primaryString.overwrite(directStrings))
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "way out")))
.build(),
ParsedAndroidDataBuilder.buildOn(fqnFactory)
.overwritable(
@@ -263,10 +274,14 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "wrong way out")),
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "wrong way out")),
xml("string/exit")
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")))
.build();
UnvalidatedAndroidData primary =
@@ -284,10 +299,12 @@ public class AndroidDataMergerTest {
fqnFactory.parse("string/exit"),
DataResourceXml.createWithNoNamespace(
directRoot.resolve("res/values/strings.xml"),
- SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")),
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")),
DataResourceXml.createWithNoNamespace(
directRoot.resolve("res/values/strings.xml"),
- SimpleXmlResourceValue.createWithValue(Type.STRING, "wrong way out")))
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "wrong way out")))
.toConflictMessage());
}
@@ -304,10 +321,14 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "way out")),
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "way out")),
xml("string/exit")
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "way out")))
.build();
UnvalidatedAndroidData primary =
@@ -335,7 +356,9 @@ public class AndroidDataMergerTest {
xml("string/exit")
.root(directRoot)
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "way out")))
.build()));
}
@@ -352,13 +375,19 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "way out")),
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "way out")),
xml("string/exit")
.source("values/more_strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "way out")),
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "way out")),
xml("string/another_key")
.source("values/more_strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "another way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "another way out")))
.build();
UnvalidatedAndroidData primary =
@@ -387,10 +416,14 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source(directStrings)
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "wrong way out")),
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "wrong way out")),
xml("string/exit")
.source(directStrings)
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")))
.build();
UnvalidatedAndroidData primary =
@@ -410,7 +443,9 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source(primaryStrings.overwrite(directStrings))
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "way out")))
.build(),
ParsedAndroidDataBuilder.empty());
assertAbout(unwrittenMergedAndroidData).that(data).isEqualTo(expected);
@@ -427,10 +462,14 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "wrong way out")),
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "wrong way out")),
xml("string/exit")
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")))
.build();
ParsedAndroidData directDependency = ParsedAndroidDataBuilder.empty();
@@ -450,10 +489,12 @@ public class AndroidDataMergerTest {
fqnFactory.parse("string/exit"),
DataResourceXml.createWithNoNamespace(
transitiveRoot.resolve("res/values/strings.xml"),
- SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")),
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")),
DataResourceXml.createWithNoNamespace(
transitiveRoot.resolve("res/values/strings.xml"),
- SimpleXmlResourceValue.createWithValue(Type.STRING, "wrong way out")))
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "wrong way out")))
.toConflictMessage());
}
@@ -470,11 +511,15 @@ public class AndroidDataMergerTest {
xml("string/exit")
.root(transitiveRoot.resolve("1"))
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "wrong way out")),
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "wrong way out")),
xml("string/exit")
.root(transitiveRoot.resolve("2"))
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")))
.build();
ParsedAndroidData directDependency =
@@ -498,7 +543,9 @@ public class AndroidDataMergerTest {
xml("string/exit")
.root(primaryRoot)
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "way out")))
.build(),
ParsedAndroidDataBuilder.empty());
assertAbout(unwrittenMergedAndroidData).that(data).isEqualTo(expected);
@@ -515,7 +562,9 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")))
.build();
ParsedAndroidData directDependency =
@@ -523,7 +572,9 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "wrong way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "wrong way out")))
.build();
UnvalidatedAndroidData primary =
@@ -540,10 +591,12 @@ public class AndroidDataMergerTest {
fqnFactory.parse("string/exit"),
DataResourceXml.createWithNoNamespace(
directRoot.resolve("res/values/strings.xml"),
- SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")),
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")),
DataResourceXml.createWithNoNamespace(
transitiveRoot.resolve("res/values/strings.xml"),
- SimpleXmlResourceValue.createWithValue(Type.STRING, "wrong way out")))
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "wrong way out")))
.toConflictMessage());
}
@@ -558,7 +611,9 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")))
.build();
ParsedAndroidData directDependency =
@@ -566,7 +621,9 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "wrong way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "wrong way out")))
.build();
UnvalidatedAndroidData primary =
@@ -584,13 +641,15 @@ public class AndroidDataMergerTest {
assertThat(loggingHandler.warnings)
.containsExactly(
MergeConflict.of(
- fullyQualifiedName,
- DataResourceXml.createWithNoNamespace(
- directRoot.resolve("res/values/strings.xml"),
- SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")),
- DataResourceXml.createWithNoNamespace(
- transitiveRoot.resolve("res/values/strings.xml"),
- SimpleXmlResourceValue.createWithValue(Type.STRING, "wrong way out")))
+ fullyQualifiedName,
+ DataResourceXml.createWithNoNamespace(
+ directRoot.resolve("res/values/strings.xml"),
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")),
+ DataResourceXml.createWithNoNamespace(
+ transitiveRoot.resolve("res/values/strings.xml"),
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "wrong way out")))
.toConflictMessage());
}
@@ -605,7 +664,9 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")))
.build();
ParsedAndroidData directDependency =
@@ -613,7 +674,9 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source("values/strings.xml")
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "wrong way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "wrong way out")))
.build();
UnvalidatedAndroidData primary =
@@ -648,7 +711,9 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source(transitiveStrings)
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "no way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "no way out")))
.build();
ParsedAndroidData directDependency =
@@ -656,7 +721,9 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source(directStrings)
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "wrong way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "wrong way out")))
.build();
UnvalidatedAndroidData primary =
@@ -677,7 +744,9 @@ public class AndroidDataMergerTest {
.overwritable(
xml("string/exit")
.source(primaryStrings.overwrite(directStrings))
- .value(SimpleXmlResourceValue.createWithValue(Type.STRING, "way out")))
+ .value(
+ SimpleXmlResourceValue.createWithValue(
+ SimpleXmlResourceValue.Type.STRING, "way out")))
.build(),
ParsedAndroidDataBuilder.empty());
assertAbout(unwrittenMergedAndroidData).that(data).isEqualTo(expected);
diff --git a/src/test/java/com/google/devtools/build/android/DataResourceXmlTest.java b/src/test/java/com/google/devtools/build/android/DataResourceXmlTest.java
index aa91bf91c3..937f2ff399 100644
--- a/src/test/java/com/google/devtools/build/android/DataResourceXmlTest.java
+++ b/src/test/java/com/google/devtools/build/android/DataResourceXmlTest.java
@@ -57,7 +57,6 @@ import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.HashMap;
import java.util.Map;
-import java.util.Map.Entry;
import javax.xml.stream.XMLStreamException;
import org.junit.Before;
import org.junit.Test;
@@ -91,7 +90,7 @@ public class DataResourceXmlTest {
Files.createDirectories(values.getParent());
StringBuilder builder = new StringBuilder();
builder.append(AndroidDataWriter.PRELUDE).append("<resources");
- for (Entry<String, String> entry : namespaces.entrySet()) {
+ for (Map.Entry<String, String> entry : namespaces.entrySet()) {
builder
.append(" xmlns:")
.append(entry.getKey())
@@ -99,7 +98,7 @@ public class DataResourceXmlTest {
.append(entry.getValue())
.append("\"");
}
- for (Entry<String, String> entry : attributes.entrySet()) {
+ for (Map.Entry<String, String> entry : attributes.entrySet()) {
builder
.append(" ")
.append(entry.getKey())
@@ -1280,28 +1279,30 @@ public class DataResourceXmlTest {
private String[] resourcesXmlFrom(Map<String, String> namespaces, Map<String, String> attributes,
Path source, String... lines) {
- FluentIterable<String> xml = FluentIterable.of(new String(AndroidDataWriter.PRELUDE))
- .append("<resources")
- .append(
- FluentIterable.from(namespaces.entrySet())
- .transform(
- new Function<Entry<String, String>, String>() {
- @Override
- public String apply(Entry<String, String> input) {
- return String.format(" xmlns:%s=\"%s\"", input.getKey(), input.getValue());
- }
- })
- .join(Joiner.on("")))
- .append(
- FluentIterable.from(attributes.entrySet())
- .transform(
- new Function<Entry<String, String>, String>() {
- @Override
- public String apply(Entry<String, String> input) {
- return String.format(" %s=\"%s\"", input.getKey(), input.getValue());
- }
- })
- .join(Joiner.on("")));
+ FluentIterable<String> xml =
+ FluentIterable.of(new String(AndroidDataWriter.PRELUDE))
+ .append("<resources")
+ .append(
+ FluentIterable.from(namespaces.entrySet())
+ .transform(
+ new Function<Map.Entry<String, String>, String>() {
+ @Override
+ public String apply(Map.Entry<String, String> input) {
+ return String.format(
+ " xmlns:%s=\"%s\"", input.getKey(), input.getValue());
+ }
+ })
+ .join(Joiner.on("")))
+ .append(
+ FluentIterable.from(attributes.entrySet())
+ .transform(
+ new Function<Map.Entry<String, String>, String>() {
+ @Override
+ public String apply(Map.Entry<String, String> input) {
+ return String.format(" %s=\"%s\"", input.getKey(), input.getValue());
+ }
+ })
+ .join(Joiner.on("")));
if (source == null && (lines == null || lines.length == 0)) {
xml = xml.append("/>");
} else {
diff --git a/src/test/java/com/google/devtools/build/android/ManifestMergerActionTest.java b/src/test/java/com/google/devtools/build/android/ManifestMergerActionTest.java
index 160978b98e..75857ae43c 100644
--- a/src/test/java/com/google/devtools/build/android/ManifestMergerActionTest.java
+++ b/src/test/java/com/google/devtools/build/android/ManifestMergerActionTest.java
@@ -33,7 +33,6 @@ import java.nio.file.Paths;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import javax.annotation.Nullable;
import org.junit.Before;
import org.junit.Test;
@@ -265,9 +264,9 @@ public class ManifestMergerActionTest {
private <K, V> String mapToDictionaryString(Map<K, V> map) {
StringBuilder sb = new StringBuilder();
- Iterator<Entry<K, V>> iter = map.entrySet().iterator();
+ Iterator<Map.Entry<K, V>> iter = map.entrySet().iterator();
while (iter.hasNext()) {
- Entry<K, V> entry = iter.next();
+ Map.Entry<K, V> entry = iter.next();
sb.append(entry.getKey().toString().replace(":", "\\:").replace(",", "\\,"));
sb.append(':');
sb.append(entry.getValue().toString().replace(":", "\\:").replace(",", "\\,"));
diff --git a/src/test/java/com/google/devtools/build/android/ParsedAndroidDataSubject.java b/src/test/java/com/google/devtools/build/android/ParsedAndroidDataSubject.java
index 07c6fa42a6..e6a1b407d1 100644
--- a/src/test/java/com/google/devtools/build/android/ParsedAndroidDataSubject.java
+++ b/src/test/java/com/google/devtools/build/android/ParsedAndroidDataSubject.java
@@ -20,7 +20,7 @@ import com.google.common.truth.FailureMetadata;
import com.google.common.truth.Subject;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map.Entry;
+import java.util.Map;
/** Testing Subject for comparing ParsedAndroidData instances. */
class ParsedAndroidDataSubject extends Subject<ParsedAndroidDataSubject, ParsedAndroidData> {
@@ -49,8 +49,8 @@ class ParsedAndroidDataSubject extends Subject<ParsedAndroidDataSubject, ParsedA
}
private <T extends DataValue> void compareDataValues(
- Iterable<Entry<DataKey, T>> actual,
- Iterable<Entry<DataKey, T>> expected,
+ Iterable<Map.Entry<DataKey, T>> actual,
+ Iterable<Map.Entry<DataKey, T>> expected,
List<String> out,
String valueType) {
List<String> errors = new ArrayList<>();