aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/google/devtools')
-rw-r--r--src/test/java/com/google/devtools/build/android/AaptCommandBuilderTest.java2
-rw-r--r--src/test/java/com/google/devtools/build/android/AndroidDataBuilder.java2
-rw-r--r--src/test/java/com/google/devtools/build/android/AndroidDataMergerTest.java2
-rw-r--r--src/test/java/com/google/devtools/build/android/AndroidDataSerializerAndDeserializerTest.java57
-rw-r--r--src/test/java/com/google/devtools/build/android/AndroidResourceClassWriterTest.java90
-rw-r--r--src/test/java/com/google/devtools/build/android/DataResourceXmlTest.java17
-rw-r--r--src/test/java/com/google/devtools/build/android/DensitySpecificManifestProcessorTest.java8
-rw-r--r--src/test/java/com/google/devtools/build/android/DensitySpecificResourceFilterTest.java3
-rw-r--r--src/test/java/com/google/devtools/build/android/DependencyAndroidDataTest.java6
-rw-r--r--src/test/java/com/google/devtools/build/android/ManifestMergerActionTest.java14
-rw-r--r--src/test/java/com/google/devtools/build/android/ParsedAndroidDataBuilder.java5
-rw-r--r--src/test/java/com/google/devtools/build/android/ParsedAndroidDataSubject.java6
-rw-r--r--src/test/java/com/google/devtools/build/android/ParsedAndroidDataTest.java23
-rw-r--r--src/test/java/com/google/devtools/build/android/RClassGeneratorActionTest.java36
-rw-r--r--src/test/java/com/google/devtools/build/android/SerializedAndroidDataTest.java11
-rw-r--r--src/test/java/com/google/devtools/build/android/SplitConfigurationFilterTest.java3
-rw-r--r--src/test/java/com/google/devtools/build/android/UnvalidatedAndroidDataTest.java28
-rw-r--r--src/test/java/com/google/devtools/build/android/UnvalidatedAndroidDirectoriesTest.java24
18 files changed, 135 insertions, 202 deletions
diff --git a/src/test/java/com/google/devtools/build/android/AaptCommandBuilderTest.java b/src/test/java/com/google/devtools/build/android/AaptCommandBuilderTest.java
index 319fa488f1..3ff518720c 100644
--- a/src/test/java/com/google/devtools/build/android/AaptCommandBuilderTest.java
+++ b/src/test/java/com/google/devtools/build/android/AaptCommandBuilderTest.java
@@ -111,7 +111,7 @@ public class AaptCommandBuilderTest {
@Test
public void testAddRepeatedWithEmptyValuesAddsNothing() {
- assertThat(new AaptCommandBuilder(aapt).addRepeated("-0", ImmutableList.<String>of()).build())
+ assertThat(new AaptCommandBuilder(aapt).addRepeated("-0", ImmutableList.of()).build())
.doesNotContain("-0");
}
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..2270ca1248 100644
--- a/src/test/java/com/google/devtools/build/android/AndroidDataBuilder.java
+++ b/src/test/java/com/google/devtools/build/android/AndroidDataBuilder.java
@@ -123,7 +123,7 @@ public class AndroidDataBuilder {
}
public AndroidDataBuilder createManifest(String path, String manifestPackage, String... lines) {
- return createManifest(path, manifestPackage, ImmutableList.<String>of(), lines);
+ return createManifest(path, manifestPackage, ImmutableList.of(), lines);
}
public AndroidDataBuilder createManifest(
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..95c90157fd 100644
--- a/src/test/java/com/google/devtools/build/android/AndroidDataMergerTest.java
+++ b/src/test/java/com/google/devtools/build/android/AndroidDataMergerTest.java
@@ -61,7 +61,7 @@ public class AndroidDataMergerTest {
@Before
public void setUp() throws Exception {
fileSystem = Jimfs.newFileSystem();
- fqnFactory = FullyQualifiedName.Factory.from(ImmutableList.<String>of());
+ fqnFactory = FullyQualifiedName.Factory.from(ImmutableList.of());
mergerLogger = Logger.getLogger(AndroidDataMerger.class.getCanonicalName());
loggingHandler = new TestLoggingHandler();
mergerLogger.addHandler(loggingHandler);
diff --git a/src/test/java/com/google/devtools/build/android/AndroidDataSerializerAndDeserializerTest.java b/src/test/java/com/google/devtools/build/android/AndroidDataSerializerAndDeserializerTest.java
index 94529e3db3..7f388c30b8 100644
--- a/src/test/java/com/google/devtools/build/android/AndroidDataSerializerAndDeserializerTest.java
+++ b/src/test/java/com/google/devtools/build/android/AndroidDataSerializerAndDeserializerTest.java
@@ -47,7 +47,7 @@ public class AndroidDataSerializerAndDeserializerTest {
@Before
public void createCleanEnvironment() throws Exception {
fs = Jimfs.newFileSystem();
- fqnFactory = FullyQualifiedName.Factory.from(ImmutableList.<String>of());
+ fqnFactory = FullyQualifiedName.Factory.from(ImmutableList.of());
source = Files.createDirectory(fs.getPath("source"));
manifest = Files.createFile(source.resolve("AndroidManifest.xml"));
}
@@ -80,8 +80,7 @@ public class AndroidDataSerializerAndDeserializerTest {
UnwrittenMergedAndroidData.of(
manifest,
ParsedAndroidDataBuilder.buildOn(source, fqnFactory)
- .combining(
- xml("id/snark").source("values/ids.xml").value(IdXmlResourceValue.of()))
+ .combining(xml("id/snark").source("values/ids.xml").value(IdXmlResourceValue.of()))
.build(),
ParsedAndroidDataBuilder.empty());
expected.serializeTo(serializer);
@@ -159,10 +158,7 @@ public class AndroidDataSerializerAndDeserializerTest {
.createManifest("AndroidManifest.xml", "com.carroll.lewis", "")
.buildParsed();
UnwrittenMergedAndroidData expected =
- UnwrittenMergedAndroidData.of(
- manifest,
- direct,
- ParsedAndroidDataBuilder.empty());
+ UnwrittenMergedAndroidData.of(manifest, direct, ParsedAndroidDataBuilder.empty());
expected.serializeTo(serializer);
serializer.flushTo(binaryPath);
@@ -172,10 +168,8 @@ public class AndroidDataSerializerAndDeserializerTest {
deserializer.read(
binaryPath,
KeyValueConsumers.of(
- overwriting,
- combining,
- null // assets
- ));
+ overwriting, combining, null // assets
+ ));
Truth.assertThat(overwriting).isEqualTo(expected.getPrimary().getOverwritingResources());
Truth.assertThat(combining).isEqualTo(expected.getPrimary().getCombiningResources());
}
@@ -190,17 +184,17 @@ public class AndroidDataSerializerAndDeserializerTest {
ParsedAndroidDataBuilder.buildOn(source, fqnFactory)
.overwritable(
file("layout/banker").source("layout/banker.xml"),
- xml("<resources>/foo").source("values/ids.xml")
- .value(ResourcesAttribute.of(
- fqnFactory.parse("<resources>/foo"), "foo", "fooVal")))
- .combining(
- xml("id/snark").source("values/ids.xml").value(IdXmlResourceValue.of()))
+ xml("<resources>/foo")
+ .source("values/ids.xml")
+ .value(
+ ResourcesAttribute.of(
+ fqnFactory.parse("<resources>/foo"), "foo", "fooVal")))
+ .combining(xml("id/snark").source("values/ids.xml").value(IdXmlResourceValue.of()))
.assets(file().source("hunting/of/the/boojum"))
.build(),
ParsedAndroidDataBuilder.buildOn(source, fqnFactory)
.overwritable(file("layout/butcher").source("layout/butcher.xml"))
- .combining(
- xml("id/snark").source("values/ids.xml").value(IdXmlResourceValue.of()))
+ .combining(xml("id/snark").source("values/ids.xml").value(IdXmlResourceValue.of()))
.assets(file().source("hunting/of/the/snark"))
.build());
expected.serializeTo(serializer);
@@ -232,36 +226,43 @@ public class AndroidDataSerializerAndDeserializerTest {
ParsedAndroidDataBuilder.buildOn(source, fqnFactory)
.overwritable(
file("layout/banker").source("layout/banker.xml"),
- xml("<resources>/foo").source("values/ids.xml")
- .value(ResourcesAttribute.of(
- fqnFactory.parse("<resources>/foo"), "foo", "fooVal")))
- .combining(
- xml("id/snark").source("values/ids.xml").value(IdXmlResourceValue.of()))
+ xml("<resources>/foo")
+ .source("values/res.xml")
+ .value(
+ ResourcesAttribute.of(
+ fqnFactory.parse("<resources>/foo"), "foo", "fooVal")))
+ .combining(xml("id/snark").source("values/ids.xml").value(IdXmlResourceValue.of()))
.assets(file().source("hunting/of/the/boojum"))
.build(),
ParsedAndroidDataBuilder.buildOn(source, fqnFactory)
.overwritable(file("layout/butcher").source("layout/butcher.xml"))
- .combining(
- xml("id/snark").source("values/ids.xml").value(IdXmlResourceValue.of()))
+ .combining(xml("id/snark").source("values/ids.xml").value(IdXmlResourceValue.of()))
.assets(file().source("hunting/of/the/snark"))
.build());
expected.serializeTo(serializer);
serializer.flushTo(binaryPath);
+ // Create a file to demonstrate an overmatched filtering
+ Files.createDirectories(source.resolve("res/values/ids.xml"));
+
AndroidDataDeserializer deserializer =
AndroidParsedDataDeserializer.withFilteredResources(
- ImmutableList.of("the/boojum", "values/ids.xml", "layout/banker.xml"));
+ ImmutableList.of(
+ "the/boojum", "values/ids.xml", "layout/banker.xml", "values/res.xml"));
KeyValueConsumers primary =
KeyValueConsumers.of(
TestMapConsumer.ofResources(), // overwriting
TestMapConsumer.ofResources(), // combining
- null // assets
+ TestMapConsumer.ofAssets() // assets
);
deserializer.read(binaryPath, primary);
Truth.assertThat(primary.overwritingConsumer).isEqualTo(Collections.emptyMap());
- Truth.assertThat(primary.combiningConsumer).isEqualTo(Collections.emptyMap());
+ Truth.assertThat(primary.combiningConsumer)
+ .named("Filtered resources that exist should not be filtered.")
+ .isEqualTo(expected.getPrimary().getCombiningResources());
+ Truth.assertThat(primary.assetConsumer).isEqualTo(Collections.emptyMap());
}
private static class TestMapConsumer<T extends DataValue>
diff --git a/src/test/java/com/google/devtools/build/android/AndroidResourceClassWriterTest.java b/src/test/java/com/google/devtools/build/android/AndroidResourceClassWriterTest.java
index 4fdaaa70c1..86d6a28c00 100644
--- a/src/test/java/com/google/devtools/build/android/AndroidResourceClassWriterTest.java
+++ b/src/test/java/com/google/devtools/build/android/AndroidResourceClassWriterTest.java
@@ -24,7 +24,6 @@ import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Rule;
@@ -45,7 +44,7 @@ public class AndroidResourceClassWriterTest {
public final ExpectedException thrown = ExpectedException.none();
private static final AndroidFrameworkAttrIdProvider mockAndroidFrameworkIds =
- new MockAndroidFrameworkAttrIdProvider(ImmutableMap.<String, Integer>of());
+ new MockAndroidFrameworkAttrIdProvider(ImmutableMap.of());
@Before
public void createCleanEnvironment() {
@@ -100,17 +99,13 @@ public class AndroidResourceClassWriterTest {
ImmutableMap.of(
"AdiosButton", 0x7f030000,
"HelloView", 0x7f030001),
- ImmutableMap.<String, List<Integer>>of(),
- false
- );
+ ImmutableMap.of(),
+ false);
assertAbout(paths)
.that(target)
.withClass("com.carroll.lewis.R$layout")
.classContentsIsEqualTo(
- ImmutableMap.of("some_layout", 0x7f020000),
- ImmutableMap.<String, List<Integer>>of(),
- false
- );
+ ImmutableMap.of("some_layout", 0x7f020000), ImmutableMap.of(), false);
}
@Test
@@ -154,9 +149,8 @@ public class AndroidResourceClassWriterTest {
ImmutableMap.of(
"light", 0x7f020000,
"patchface", 0x7f020001),
- ImmutableMap.<String, List<Integer>>of(),
- false
- );
+ ImmutableMap.of(),
+ false);
}
@Test
@@ -207,9 +201,8 @@ public class AndroidResourceClassWriterTest {
"light18", 0x7f020001,
"light19", 0x7f020002,
"light20", 0x7f020003),
- ImmutableMap.<String, List<Integer>>of(),
- false
- );
+ ImmutableMap.of(),
+ false);
}
@Test
@@ -314,9 +307,8 @@ public class AndroidResourceClassWriterTest {
"x_color", 0x7f010000,
"y_color", 0x7f010001,
"z_color", 0x7f010002),
- ImmutableMap.<String, List<Integer>>of(),
- false
- );
+ ImmutableMap.of(),
+ false);
assertAbout(paths)
.that(target)
.withClass("com.carroll.lewis.R$style")
@@ -324,9 +316,8 @@ public class AndroidResourceClassWriterTest {
ImmutableMap.of(
"YStyle", 0x7f020000,
"ZStyle_ABC", 0x7f020001),
- ImmutableMap.<String, List<Integer>>of(),
- false
- );
+ ImmutableMap.of(),
+ false);
assertAbout(paths)
.that(target)
.withClass("com.carroll.lewis.R$styleable")
@@ -339,14 +330,12 @@ public class AndroidResourceClassWriterTest {
.put("com_google_android_Swirls_Fancy_y_color", 1)
.put("com_google_android_Swirls_Fancy_z_color", 2)
.build(),
- ImmutableMap.<String, List<Integer>>of(
+ ImmutableMap.of(
"com_google_android_Dots",
ImmutableList.of(0x7f010000, 0x7f010001, 0x7f010002),
"com_google_android_Swirls_Fancy",
- ImmutableList.of(0x7f010000, 0x7f010001, 0x7f010002)
- ),
- false
- );
+ ImmutableList.of(0x7f010000, 0x7f010001, 0x7f010002)),
+ false);
}
@Test
@@ -429,18 +418,12 @@ public class AndroidResourceClassWriterTest {
ImmutableMap.of(
"aaa", 0x7f010000,
"zzz", 0x7f010001),
- ImmutableMap.<String, List<Integer>>of(),
- false
- );
+ ImmutableMap.of(),
+ false);
assertAbout(paths)
.that(target)
.withClass("com.carroll.lewis.R$style")
- .classContentsIsEqualTo(
- ImmutableMap.of(
- "YStyle", 0x7f020000),
- ImmutableMap.<String, List<Integer>>of(),
- false
- );
+ .classContentsIsEqualTo(ImmutableMap.of("YStyle", 0x7f020000), ImmutableMap.of(), false);
assertAbout(paths)
.that(target)
.withClass("com.carroll.lewis.R$styleable")
@@ -449,14 +432,11 @@ public class AndroidResourceClassWriterTest {
"com_google_android_Dots_android_textColor", 0,
"com_google_android_Dots_android_textSize", 1,
"com_google_android_Dots_aaa", 2,
- "com_google_android_Dots_zzz", 3
- ),
- ImmutableMap.<String, List<Integer>>of(
+ "com_google_android_Dots_zzz", 3),
+ ImmutableMap.of(
"com_google_android_Dots",
- ImmutableList.of(0x01000000, 0x01000010, 0x7f010000, 0x7f010001)
- ),
- false
- );
+ ImmutableList.of(0x01000000, 0x01000010, 0x7f010000, 0x7f010001)),
+ false);
}
@Test
@@ -465,9 +445,7 @@ public class AndroidResourceClassWriterTest {
Path source = fs.getPath("source");
AndroidResourceClassWriter resourceClassWriter =
AndroidResourceClassWriter.of(
- new MockAndroidFrameworkAttrIdProvider(ImmutableMap.<String, Integer>of()),
- target,
- "com.carroll.lewis");
+ new MockAndroidFrameworkAttrIdProvider(ImmutableMap.of()), target, "com.carroll.lewis");
ParsedAndroidData direct =
AndroidDataBuilder.of(source)
.addResource(
@@ -500,9 +478,7 @@ public class AndroidResourceClassWriterTest {
Path source = fs.getPath("source");
AndroidResourceClassWriter resourceClassWriter =
AndroidResourceClassWriter.of(
- new MockAndroidFrameworkAttrIdProvider(ImmutableMap.<String, Integer>of()),
- target,
- "com.carroll.lewis");
+ new MockAndroidFrameworkAttrIdProvider(ImmutableMap.of()), target, "com.carroll.lewis");
ParsedAndroidData direct =
AndroidDataBuilder.of(source)
.addResource(
@@ -567,11 +543,7 @@ public class AndroidResourceClassWriterTest {
assertAbout(paths)
.that(target)
.withClass("com.boop.R$drawable")
- .classContentsIsEqualTo(
- ImmutableMap.of("1", 0x7f020000),
- ImmutableMap.<String, List<Integer>>of(),
- false
- );
+ .classContentsIsEqualTo(ImmutableMap.of("1", 0x7f020000), ImmutableMap.of(), false);
}
/**
@@ -613,11 +585,7 @@ public class AndroidResourceClassWriterTest {
assertAbout(paths)
.that(target)
.withClass("com.boop.R$drawable")
- .classContentsIsEqualTo(
- ImmutableMap.of("c++", 0x7f020000),
- ImmutableMap.<String, List<Integer>>of(),
- false
- );
+ .classContentsIsEqualTo(ImmutableMap.of("c++", 0x7f020000), ImmutableMap.of(), false);
}
/**
@@ -660,11 +628,7 @@ public class AndroidResourceClassWriterTest {
assertAbout(paths)
.that(target)
.withClass("com.boop.R$integer")
- .classContentsIsEqualTo(
- ImmutableMap.of("c++", 0x7f020000),
- ImmutableMap.<String, List<Integer>>of(),
- false
- );
+ .classContentsIsEqualTo(ImmutableMap.of("c++", 0x7f020000), ImmutableMap.of(), false);
}
private static class MockAndroidFrameworkAttrIdProvider
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..b8309e8022 100644
--- a/src/test/java/com/google/devtools/build/android/DataResourceXmlTest.java
+++ b/src/test/java/com/google/devtools/build/android/DataResourceXmlTest.java
@@ -77,12 +77,11 @@ public class DataResourceXmlTest {
@Before
public void createCleanEnvironment() {
fs = Jimfs.newFileSystem();
- fqnFactory = FullyQualifiedName.Factory.from(ImmutableList.<String>of());
+ fqnFactory = FullyQualifiedName.Factory.from(ImmutableList.of());
}
private Path writeResourceXml(String... xml) throws IOException {
- return writeResourceXml(ImmutableMap.<String, String>of(), ImmutableMap.<String, String>of(),
- xml);
+ return writeResourceXml(ImmutableMap.of(), ImmutableMap.of(), xml);
}
private Path writeResourceXml(Map<String, String> namespaces, Map<String, String> attributes,
@@ -757,7 +756,7 @@ public class DataResourceXmlTest {
.xmlContentsIsEqualTo(
resourcesXmlFrom(
XLIFF_NAMESPACES,
- ImmutableMap.<String, String>of(),
+ ImmutableMap.of(),
source,
"<string name=\"star_rating\">Check out our 5",
" <xliff:g id=\"star\">\\u2605</xliff:g>",
@@ -792,7 +791,7 @@ public class DataResourceXmlTest {
.xmlContentsIsEqualTo(
resourcesXmlFrom(
ImmutableMap.of("ns1", "urn:oasis:names:tc:xliff:document:1.2"),
- ImmutableMap.<String, String>of(),
+ ImmutableMap.of(),
source,
"<string name=\"star_rating\">Check out our 5 ",
"<ns1:g xmlns:foglebert=\"defogle\" " + "foglebert:id=\"star\">\\u2605</ns1:g>",
@@ -830,11 +829,10 @@ public class DataResourceXmlTest {
"</string>"
};
- Path source = writeResourceXml(XLIFF_NAMESPACES, ImmutableMap.<String, String>of(), xml);
+ Path source = writeResourceXml(XLIFF_NAMESPACES, ImmutableMap.of(), xml);
assertAbout(resourcePaths)
.that(parsedAndWritten(source, fqn("string/AAP_SUGGEST_ACCEPT_SUGGESTION")))
- .xmlContentsIsEqualTo(
- resourcesXmlFrom(XLIFF_NAMESPACES, ImmutableMap.<String, String>of(), source, xml));
+ .xmlContentsIsEqualTo(resourcesXmlFrom(XLIFF_NAMESPACES, ImmutableMap.of(), source, xml));
}
@Test
@@ -1274,8 +1272,7 @@ public class DataResourceXmlTest {
}
private String[] resourcesXmlFrom(Path source, String... lines) {
- return resourcesXmlFrom(ImmutableMap.<String, String>of(), ImmutableMap.<String, String>of(),
- source, lines);
+ return resourcesXmlFrom(ImmutableMap.of(), ImmutableMap.of(), source, lines);
}
private String[] resourcesXmlFrom(Map<String, String> namespaces, Map<String, String> attributes,
diff --git a/src/test/java/com/google/devtools/build/android/DensitySpecificManifestProcessorTest.java b/src/test/java/com/google/devtools/build/android/DensitySpecificManifestProcessorTest.java
index e43cc9f8c9..96fa095df4 100644
--- a/src/test/java/com/google/devtools/build/android/DensitySpecificManifestProcessorTest.java
+++ b/src/test/java/com/google/devtools/build/android/DensitySpecificManifestProcessorTest.java
@@ -54,8 +54,10 @@ public class DensitySpecificManifestProcessorTest {
"<manifest xmlns:android='http://schemas.android.com/apk/res/android'",
" package='com.google.test'>",
"</manifest>");
- Path modified = new DensitySpecificManifestProcessor(ImmutableList.<String>of(),
- tmp.resolve("manifest-filtered/AndroidManifest.xml")).process(manifest);
+ Path modified =
+ new DensitySpecificManifestProcessor(
+ ImmutableList.of(), tmp.resolve("manifest-filtered/AndroidManifest.xml"))
+ .process(manifest);
assertThat((Object) modified).isEqualTo(manifest);
}
@@ -140,7 +142,7 @@ public class DensitySpecificManifestProcessorTest {
Path modified = new DensitySpecificManifestProcessor(densities,
tmp.resolve("manifest-filtered/AndroidManifest.xml")).process(manifest);
assertThat((Object) modified).isNotNull();
- checkModification(modified, ImmutableList.<String>of("ldpi", "xxhdpi"));
+ checkModification(modified, ImmutableList.of("ldpi", "xxhdpi"));
}
@Test public void testMalformedManifest() throws Exception {
diff --git a/src/test/java/com/google/devtools/build/android/DensitySpecificResourceFilterTest.java b/src/test/java/com/google/devtools/build/android/DensitySpecificResourceFilterTest.java
index 03f38e93e9..628dc3bf18 100644
--- a/src/test/java/com/google/devtools/build/android/DensitySpecificResourceFilterTest.java
+++ b/src/test/java/com/google/devtools/build/android/DensitySpecificResourceFilterTest.java
@@ -132,8 +132,7 @@ public class DensitySpecificResourceFilterTest {
@Test public void testUnknownDensityFails() {
try {
checkTransformedResources(
- ImmutableList.<String>of(), ImmutableList.<String>of(),
- ImmutableList.of("xxhdpi", "322dpi"));
+ ImmutableList.of(), ImmutableList.of(), ImmutableList.of("xxhdpi", "322dpi"));
fail("expected MergingException");
} catch (MergingException expected) {
}
diff --git a/src/test/java/com/google/devtools/build/android/DependencyAndroidDataTest.java b/src/test/java/com/google/devtools/build/android/DependencyAndroidDataTest.java
index 5aef80cf65..769b46896c 100644
--- a/src/test/java/com/google/devtools/build/android/DependencyAndroidDataTest.java
+++ b/src/test/java/com/google/devtools/build/android/DependencyAndroidDataTest.java
@@ -105,7 +105,7 @@ public class DependencyAndroidDataTest {
":assets:AndroidManifest.xml:r.txt:symbols.bin", fileSystem))
.isEqualTo(
new DependencyAndroidData(
- ImmutableList.<Path>of(), ImmutableList.of(assets), manifest, rTxt, symbols, null));
+ ImmutableList.of(), ImmutableList.of(assets), manifest, rTxt, symbols, null));
}
@Test public void flagParseWithEmptyAssets() throws Exception{
@@ -113,7 +113,7 @@ public class DependencyAndroidDataTest {
DependencyAndroidData.valueOf("res::AndroidManifest.xml:r.txt:symbols.bin", fileSystem))
.isEqualTo(
new DependencyAndroidData(
- ImmutableList.of(res), ImmutableList.<Path>of(), manifest, rTxt, symbols, null));
+ ImmutableList.of(res), ImmutableList.of(), manifest, rTxt, symbols, null));
}
@Test public void flagParseWithEmptyResourcesAndAssets() throws Exception{
@@ -121,7 +121,7 @@ public class DependencyAndroidDataTest {
DependencyAndroidData.valueOf("::AndroidManifest.xml:r.txt:symbols.bin", fileSystem))
.isEqualTo(
new DependencyAndroidData(
- ImmutableList.<Path>of(), ImmutableList.<Path>of(), manifest, rTxt, symbols, null));
+ ImmutableList.of(), ImmutableList.of(), manifest, rTxt, symbols, null));
}
@Test public void flagNoManifestFails() {
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 9b989adba0..5e3cf8e0ea 100644
--- a/src/test/java/com/google/devtools/build/android/ManifestMergerActionTest.java
+++ b/src/test/java/com/google/devtools/build/android/ManifestMergerActionTest.java
@@ -173,8 +173,8 @@ public class ManifestMergerActionTest {
.getManifest();
// libFoo manifest merging
- List<String> args = generateArgs(libFooManifest, ImmutableMap.<Path, String>of(), true,
- ImmutableMap.<String, String>of(), "", libFooOutput);
+ List<String> args =
+ generateArgs(libFooManifest, ImmutableMap.of(), true, ImmutableMap.of(), "", libFooOutput);
ManifestMergerAction.main(args.toArray(new String[0]));
assertThat(Joiner.on(" ")
.join(Files.readAllLines(libFooOutput, UTF_8))
@@ -186,8 +186,14 @@ public class ManifestMergerActionTest {
+ "</manifest>");
// libBar manifest merging
- args = generateArgs(libBarManifest, ImmutableMap.<Path, String>of(), true,
- ImmutableMap.<String, String>of(), "com.google.libbar", libBarOutput);
+ args =
+ generateArgs(
+ libBarManifest,
+ ImmutableMap.of(),
+ true,
+ ImmutableMap.of(),
+ "com.google.libbar",
+ libBarOutput);
ManifestMergerAction.main(args.toArray(new String[0]));
assertThat(Joiner.on(" ")
.join(Files.readAllLines(libBarOutput, UTF_8))
diff --git a/src/test/java/com/google/devtools/build/android/ParsedAndroidDataBuilder.java b/src/test/java/com/google/devtools/build/android/ParsedAndroidDataBuilder.java
index 21e79dae94..59cae58f4d 100644
--- a/src/test/java/com/google/devtools/build/android/ParsedAndroidDataBuilder.java
+++ b/src/test/java/com/google/devtools/build/android/ParsedAndroidDataBuilder.java
@@ -48,10 +48,7 @@ public class ParsedAndroidDataBuilder {
public static ParsedAndroidData empty() {
return ParsedAndroidData.of(
- ImmutableSet.<MergeConflict>of(),
- ImmutableMap.<DataKey, DataResource>of(),
- ImmutableMap.<DataKey, DataResource>of(),
- ImmutableMap.<DataKey, DataAsset>of());
+ ImmutableSet.of(), ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of());
}
public static ParsedAndroidDataBuilder buildOn(
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..824a109857 100644
--- a/src/test/java/com/google/devtools/build/android/ParsedAndroidDataSubject.java
+++ b/src/test/java/com/google/devtools/build/android/ParsedAndroidDataSubject.java
@@ -31,14 +31,14 @@ class ParsedAndroidDataSubject extends Subject<ParsedAndroidDataSubject, ParsedA
public void isEqualTo(ParsedAndroidData expectation) {
List<String> errors = new ArrayList<>();
- this.<DataAsset>compareDataValues(
+ this.compareDataValues(
actual().iterateAssetEntries(), expectation.iterateAssetEntries(), errors, "assets");
- this.<DataResource>compareDataValues(
+ this.compareDataValues(
actual().iterateCombiningEntries(),
expectation.iterateCombiningEntries(),
errors,
"combining");
- this.<DataResource>compareDataValues(
+ this.compareDataValues(
actual().iterateOverwritableEntries(),
expectation.iterateOverwritableEntries(),
errors,
diff --git a/src/test/java/com/google/devtools/build/android/ParsedAndroidDataTest.java b/src/test/java/com/google/devtools/build/android/ParsedAndroidDataTest.java
index e7a55bc9a4..d296252151 100644
--- a/src/test/java/com/google/devtools/build/android/ParsedAndroidDataTest.java
+++ b/src/test/java/com/google/devtools/build/android/ParsedAndroidDataTest.java
@@ -47,7 +47,7 @@ public class ParsedAndroidDataTest {
@Before
public void createCleanEnvironment() {
fs = Jimfs.newFileSystem();
- fqnFactory = FullyQualifiedName.Factory.from(ImmutableList.<String>of());
+ fqnFactory = FullyQualifiedName.Factory.from(ImmutableList.of());
}
@Test
@@ -98,10 +98,9 @@ public class ParsedAndroidDataTest {
ImmutableSet.of(
MergeConflict.of(
key, DataValueFile.of(assetSource), DataValueFile.of(otherAssetSource))),
- ImmutableMap.<DataKey, DataResource>of(),
- ImmutableMap.<DataKey, DataResource>of(),
- ImmutableMap.<DataKey, DataAsset>of(
- key, DataValueFile.of(otherAssetSource.overwrite(assetSource)))));
+ ImmutableMap.of(),
+ ImmutableMap.of(),
+ ImmutableMap.of(key, DataValueFile.of(otherAssetSource.overwrite(assetSource)))));
}
@Test
@@ -142,7 +141,7 @@ public class ParsedAndroidDataTest {
.buildDependency()));
FullyQualifiedName.Factory fqnFactory =
- FullyQualifiedName.Factory.from(ImmutableList.<String>of("hdpi", "v4"));
+ FullyQualifiedName.Factory.from(ImmutableList.of("hdpi", "v4"));
FullyQualifiedName drawable = fqnFactory.parse("drawable/seven_eight");
assertThat(dataSet.getOverwritingResources())
.containsExactly(
@@ -183,9 +182,7 @@ public class ParsedAndroidDataTest {
ParsedAndroidData dataSet =
ParsedAndroidData.from(
new UnvalidatedAndroidData(
- ImmutableList.of(root),
- ImmutableList.<Path>of(),
- root.resolve("AndroidManifest.xml")));
+ ImmutableList.of(root), ImmutableList.of(), root.resolve("AndroidManifest.xml")));
FullyQualifiedName layoutFoo = fqnFactory.parse("layout/foo");
FullyQualifiedName drawableMenu = fqnFactory.parse("drawable/menu");
@@ -362,7 +359,7 @@ public class ParsedAndroidDataTest {
DataResourceXml.createWithNoNamespace(
otherRootValuesPath,
ResourcesAttribute.of(attributeFoo, "foo", "fooVal")))),
- ImmutableMap.<DataKey, DataResource>of(
+ ImmutableMap.of(
drawableMenu, // key
DataValueFile.of(
otherRootDrawableMenuPath.overwrite(rootDrawableMenuPath)), // value
@@ -376,12 +373,12 @@ public class ParsedAndroidDataTest {
SimpleXmlResourceValue.createWithValue(
SimpleXmlResourceValue.Type.STRING, "way out")) // value
),
- ImmutableMap.<DataKey, DataResource>of(
+ ImmutableMap.of(
idSomeId, // key
DataResourceXml.createWithNoNamespace(
rootValuesPath, IdXmlResourceValue.of()) // value
),
- ImmutableMap.<DataKey, DataAsset>of()));
+ ImmutableMap.of()));
}
@Test
@@ -547,7 +544,7 @@ public class ParsedAndroidDataTest {
.createManifest("AndroidManifest.xml", "com.carroll.lewis", "")
.buildParsed();
FullyQualifiedName.Factory fqnV21Factory =
- FullyQualifiedName.Factory.from(ImmutableList.<String>of("v21"));
+ FullyQualifiedName.Factory.from(ImmutableList.of("v21"));
FullyQualifiedName drawableKey = fqnV21Factory.parse("drawable/some_drawable");
Path drawablePath = root.resolve("res/drawable-v21/some_drawable.xml");
assertThat(dataSet.getOverwritingResources())
diff --git a/src/test/java/com/google/devtools/build/android/RClassGeneratorActionTest.java b/src/test/java/com/google/devtools/build/android/RClassGeneratorActionTest.java
index e03348cdaa..2f3ae78549 100644
--- a/src/test/java/com/google/devtools/build/android/RClassGeneratorActionTest.java
+++ b/src/test/java/com/google/devtools/build/android/RClassGeneratorActionTest.java
@@ -109,7 +109,7 @@ public class RClassGeneratorActionTest {
Path jarPath = tempDir.resolve("app_resources.jar");
RClassGeneratorAction.main(
- ImmutableList.<String>of(
+ ImmutableList.of(
"--primaryRTxt",
binarySymbols.toString(),
"--primaryManifest",
@@ -165,7 +165,7 @@ public class RClassGeneratorActionTest {
Path jarPath = tempDir.resolve("app_resources.jar");
RClassGeneratorAction.main(
- ImmutableList.<String>of(
+ ImmutableList.of(
"--library",
libFooSymbols + "," + libFooManifest,
"--library",
@@ -212,11 +212,12 @@ public class RClassGeneratorActionTest {
Path jarPath = tempDir.resolve("app_resources.jar");
- RClassGeneratorAction.main(ImmutableList.<String>of(
- "--primaryRTxt", binarySymbols.toString(),
- "--primaryManifest", binaryManifest.toString(),
- "--classJarOutput", jarPath.toString()
- ).toArray(new String[0]));
+ RClassGeneratorAction.main(
+ ImmutableList.of(
+ "--primaryRTxt", binarySymbols.toString(),
+ "--primaryManifest", binaryManifest.toString(),
+ "--classJarOutput", jarPath.toString())
+ .toArray(new String[0]));
assertThat(Files.exists(jarPath)).isTrue();
assertThat(Files.getLastModifiedTime(jarPath)).isEqualTo(FileTime.fromMillis(0));
@@ -239,9 +240,8 @@ public class RClassGeneratorActionTest {
@Test
public void noBinary() throws Exception {
Path jarPath = tempDir.resolve("app_resources.jar");
- RClassGeneratorAction.main(ImmutableList.<String>of(
- "--classJarOutput", jarPath.toString()
- ).toArray(new String[0]));
+ RClassGeneratorAction.main(
+ ImmutableList.of("--classJarOutput", jarPath.toString()).toArray(new String[0]));
assertThat(Files.exists(jarPath)).isTrue();
assertThat(Files.getLastModifiedTime(jarPath)).isEqualTo(FileTime.fromMillis(0));
@@ -271,7 +271,7 @@ public class RClassGeneratorActionTest {
"int string ok 0x1");
Path jarPath = tempDir.resolve("app_resources.jar");
RClassGeneratorAction.main(
- ImmutableList.<String>of(
+ ImmutableList.of(
"--primaryRTxt",
binarySymbols.toString(),
"--primaryManifest",
@@ -313,13 +313,13 @@ public class RClassGeneratorActionTest {
Path binarySymbols = createFile("R.txt", "");
Path jarPath = tempDir.resolve("app_resources.jar");
RClassGeneratorAction.main(
- ImmutableList.<String>of(
- "--primaryRTxt",
- binarySymbols.toString(),
- "--primaryManifest",
- binaryManifest.toString(),
- "--classJarOutput",
- jarPath.toString())
+ ImmutableList.of(
+ "--primaryRTxt",
+ binarySymbols.toString(),
+ "--primaryManifest",
+ binaryManifest.toString(),
+ "--classJarOutput",
+ jarPath.toString())
.toArray(new String[0]));
assertThat(Files.exists(jarPath)).isTrue();
diff --git a/src/test/java/com/google/devtools/build/android/SerializedAndroidDataTest.java b/src/test/java/com/google/devtools/build/android/SerializedAndroidDataTest.java
index eb9837f39f..cc3cba7293 100644
--- a/src/test/java/com/google/devtools/build/android/SerializedAndroidDataTest.java
+++ b/src/test/java/com/google/devtools/build/android/SerializedAndroidDataTest.java
@@ -78,11 +78,10 @@ public class SerializedAndroidDataTest {
@Test
public void flagParseWithEmptyResources() throws Exception {
Truth.assertThat(
- SerializedAndroidData.valueOf(
- ";assets;//some_target/foo:foo;symbols.bin", fileSystem))
+ SerializedAndroidData.valueOf(";assets;//some_target/foo:foo;symbols.bin", fileSystem))
.isEqualTo(
new SerializedAndroidData(
- ImmutableList.<Path>of(), ImmutableList.of(assets), label, symbols));
+ ImmutableList.of(), ImmutableList.of(assets), label, symbols));
}
@Test
@@ -90,8 +89,7 @@ public class SerializedAndroidDataTest {
Truth.assertThat(
SerializedAndroidData.valueOf("res;;//some_target/foo:foo;symbols.bin", fileSystem))
.isEqualTo(
- new SerializedAndroidData(
- ImmutableList.of(res), ImmutableList.<Path>of(), label, symbols));
+ new SerializedAndroidData(ImmutableList.of(res), ImmutableList.of(), label, symbols));
}
@Test
@@ -99,8 +97,7 @@ public class SerializedAndroidDataTest {
Truth.assertThat(
SerializedAndroidData.valueOf(";;//some_target/foo:foo;symbols.bin", fileSystem))
.isEqualTo(
- new SerializedAndroidData(
- ImmutableList.<Path>of(), ImmutableList.<Path>of(), label, symbols));
+ new SerializedAndroidData(ImmutableList.of(), ImmutableList.of(), label, symbols));
}
@Test
diff --git a/src/test/java/com/google/devtools/build/android/SplitConfigurationFilterTest.java b/src/test/java/com/google/devtools/build/android/SplitConfigurationFilterTest.java
index db55ac1e68..e3c1195ee5 100644
--- a/src/test/java/com/google/devtools/build/android/SplitConfigurationFilterTest.java
+++ b/src/test/java/com/google/devtools/build/android/SplitConfigurationFilterTest.java
@@ -34,8 +34,7 @@ public final class SplitConfigurationFilterTest {
@Test
public void mapFilenamesToSplitFlagsShouldReturnEmptyMapForEmptyInput()
throws UnrecognizedSplitsException {
- assertThat(mapFilenamesToSplitFlags(ImmutableList.<String>of(), ImmutableList.<String>of()))
- .isEmpty();
+ assertThat(mapFilenamesToSplitFlags(ImmutableList.of(), ImmutableList.of())).isEmpty();
}
@Test
diff --git a/src/test/java/com/google/devtools/build/android/UnvalidatedAndroidDataTest.java b/src/test/java/com/google/devtools/build/android/UnvalidatedAndroidDataTest.java
index 2a662f7430..ee97a77d1a 100644
--- a/src/test/java/com/google/devtools/build/android/UnvalidatedAndroidDataTest.java
+++ b/src/test/java/com/google/devtools/build/android/UnvalidatedAndroidDataTest.java
@@ -58,33 +58,19 @@ public class UnvalidatedAndroidDataTest {
}
@Test public void flagParseWithEmptyResources() throws Exception {
- Truth.assertThat(
- UnvalidatedAndroidData.valueOf(
- ":assets:AndroidManifest.xml", fileSystem)
- ).isEqualTo(
- new UnvalidatedAndroidData(ImmutableList.<Path>of(),
- ImmutableList.of(assets),
- manifest));
+ Truth.assertThat(UnvalidatedAndroidData.valueOf(":assets:AndroidManifest.xml", fileSystem))
+ .isEqualTo(
+ new UnvalidatedAndroidData(ImmutableList.of(), ImmutableList.of(assets), manifest));
}
@Test public void flagParseWithEmptyAssets() throws Exception {
- Truth.assertThat(
- UnvalidatedAndroidData.valueOf(
- "res::AndroidManifest.xml", fileSystem)
- ).isEqualTo(
- new UnvalidatedAndroidData(ImmutableList.of(res),
- ImmutableList.<Path>of(),
- manifest));
+ Truth.assertThat(UnvalidatedAndroidData.valueOf("res::AndroidManifest.xml", fileSystem))
+ .isEqualTo(new UnvalidatedAndroidData(ImmutableList.of(res), ImmutableList.of(), manifest));
}
@Test public void flagParseWithEmptyResourcesAndAssets() throws Exception {
- Truth.assertThat(
- UnvalidatedAndroidData.valueOf(
- "::AndroidManifest.xml", fileSystem)
- ).isEqualTo(
- new UnvalidatedAndroidData(ImmutableList.<Path>of(),
- ImmutableList.<Path>of(),
- manifest));
+ Truth.assertThat(UnvalidatedAndroidData.valueOf("::AndroidManifest.xml", fileSystem))
+ .isEqualTo(new UnvalidatedAndroidData(ImmutableList.of(), ImmutableList.of(), manifest));
}
@Test public void flagNoManifestFails() {
diff --git a/src/test/java/com/google/devtools/build/android/UnvalidatedAndroidDirectoriesTest.java b/src/test/java/com/google/devtools/build/android/UnvalidatedAndroidDirectoriesTest.java
index 1d70d81915..a0b1129dac 100644
--- a/src/test/java/com/google/devtools/build/android/UnvalidatedAndroidDirectoriesTest.java
+++ b/src/test/java/com/google/devtools/build/android/UnvalidatedAndroidDirectoriesTest.java
@@ -52,30 +52,18 @@ public class UnvalidatedAndroidDirectoriesTest {
}
@Test public void flagParseWithEmptyAssets() throws Exception {
- Truth.assertThat(
- UnvalidatedAndroidDirectories.valueOf(
- "res:", fileSystem)
- ).isEqualTo(
- new UnvalidatedAndroidDirectories(ImmutableList.of(res),
- ImmutableList.<Path>of()));
+ Truth.assertThat(UnvalidatedAndroidDirectories.valueOf("res:", fileSystem))
+ .isEqualTo(new UnvalidatedAndroidDirectories(ImmutableList.of(res), ImmutableList.of()));
}
@Test public void flagParseWithEmptyResources() throws Exception {
- Truth.assertThat(
- UnvalidatedAndroidDirectories.valueOf(
- ":assets", fileSystem)
- ).isEqualTo(
- new UnvalidatedAndroidDirectories(ImmutableList.<Path>of(),
- ImmutableList.of(assets)));
+ Truth.assertThat(UnvalidatedAndroidDirectories.valueOf(":assets", fileSystem))
+ .isEqualTo(new UnvalidatedAndroidDirectories(ImmutableList.of(), ImmutableList.of(assets)));
}
@Test public void flagParseWithEmptyResourcesAndAssets() throws Exception {
- Truth.assertThat(
- UnvalidatedAndroidDirectories.valueOf(
- ":", fileSystem)
- ).isEqualTo(
- new UnvalidatedAndroidDirectories(ImmutableList.<Path>of(),
- ImmutableList.<Path>of()));
+ Truth.assertThat(UnvalidatedAndroidDirectories.valueOf(":", fileSystem))
+ .isEqualTo(new UnvalidatedAndroidDirectories(ImmutableList.of(), ImmutableList.of()));
}
}