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/ConvertersTest.java14
-rw-r--r--src/test/java/com/google/devtools/build/android/ideinfo/JarFilterTest.java19
2 files changed, 18 insertions, 15 deletions
diff --git a/src/test/java/com/google/devtools/build/android/ConvertersTest.java b/src/test/java/com/google/devtools/build/android/ConvertersTest.java
index 92c9cf2f22..0e7385171c 100644
--- a/src/test/java/com/google/devtools/build/android/ConvertersTest.java
+++ b/src/test/java/com/google/devtools/build/android/ConvertersTest.java
@@ -58,9 +58,9 @@ public final class ConvertersTest {
@Test
public void testPathConverter_invalid() throws Exception {
String arg = "\u0000";
+ PathConverter converter = new PathConverter();
expected.expect(OptionsParsingException.class);
expected.expectMessage(String.format("%s is not a valid path:", arg));
- PathConverter converter = new PathConverter();
converter.convert(arg);
}
@@ -74,9 +74,9 @@ public final class ConvertersTest {
@Test
public void testExistingPathConverter_nonExisting() throws Exception {
String arg = "test_file";
+ ExistingPathConverter converter = new ExistingPathConverter();
expected.expect(OptionsParsingException.class);
expected.expectMessage(String.format("%s is not a valid path: it does not exist.", arg));
- ExistingPathConverter converter = new ExistingPathConverter();
converter.convert(arg);
}
@@ -101,38 +101,38 @@ public final class ConvertersTest {
@Test
public void testExisingPathListConverter() throws Exception {
String arg = "non-existing";
+ ExistingPathListConverter converter = new ExistingPathListConverter();
Path existingFile = tmp.newFile("existing").toPath();
expected.expect(OptionsParsingException.class);
expected.expectMessage(String.format("%s is not a valid path: it does not exist.", arg));
- ExistingPathListConverter converter = new ExistingPathListConverter();
converter.convert(Joiner.on(SEPARATOR).join(existingFile.toString(), arg));
}
@Test
public void testStringDictionaryConverter_emptyEntry() throws Exception {
+ StringDictionaryConverter converter = new StringDictionaryConverter();
expected.expect(OptionsParsingException.class);
expected.expectMessage("Dictionary entry [] does not contain both a key and a value.");
- StringDictionaryConverter converter = new StringDictionaryConverter();
converter.convert("foo:bar,,baz:bar");
}
@Test
public void testStringDictionaryConverter_missingKeyOrValue() throws Exception {
String badEntry = "foo";
+ StringDictionaryConverter converter = new StringDictionaryConverter();
expected.expect(OptionsParsingException.class);
expected.expectMessage(String.format(
"Dictionary entry [%s] does not contain both a key and a value.", badEntry));
- StringDictionaryConverter converter = new StringDictionaryConverter();
converter.convert(badEntry);
}
@Test
public void testStringDictionaryConverter_extraFields() throws Exception {
String badEntry = "foo:bar:baz";
+ StringDictionaryConverter converter = new StringDictionaryConverter();
expected.expect(OptionsParsingException.class);
expected.expectMessage(String.format(
"Dictionary entry [%s] contains too many fields.", badEntry));
- StringDictionaryConverter converter = new StringDictionaryConverter();
converter.convert(badEntry);
}
@@ -140,10 +140,10 @@ public final class ConvertersTest {
public void testStringDictionaryConverter_duplicateKey() throws Exception {
String key = "foo";
String arg = String.format("%s:%s,%s:%s", key, "bar", key, "baz");
+ StringDictionaryConverter converter = new StringDictionaryConverter();
expected.expect(OptionsParsingException.class);
expected.expectMessage(String.format(
"Dictionary already contains the key [%s].", key));
- StringDictionaryConverter converter = new StringDictionaryConverter();
converter.convert(arg);
}
diff --git a/src/test/java/com/google/devtools/build/android/ideinfo/JarFilterTest.java b/src/test/java/com/google/devtools/build/android/ideinfo/JarFilterTest.java
index a17048d9e0..2bb779f088 100644
--- a/src/test/java/com/google/devtools/build/android/ideinfo/JarFilterTest.java
+++ b/src/test/java/com/google/devtools/build/android/ideinfo/JarFilterTest.java
@@ -17,7 +17,6 @@ package com.google.devtools.build.android.ideinfo;
import static com.google.common.truth.Truth.assertThat;
import static java.nio.charset.StandardCharsets.UTF_8;
-import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.io.Files;
@@ -106,7 +105,7 @@ public class JarFilterTest {
String[] args =
new String[] {
- "--jars",
+ "--jar",
filterJar.getPath(),
"--output",
outputJar.getPath(),
@@ -198,13 +197,17 @@ public class JarFilterTest {
String[] args =
new String[] {
- "--keep_java_files",
- fooJava.getPath() + File.pathSeparator + barJava.getPath(),
- "--keep_source_jars",
- Joiner.on(File.pathSeparator).join(srcJar.getPath(), src3Jar.getPath()),
- "--filter_jars",
+ "--keep_java_file",
+ fooJava.getPath(),
+ "--keep_java_file",
+ barJava.getPath(),
+ "--keep_source_jar",
+ srcJar.getPath(),
+ "--keep_source_jar",
+ src3Jar.getPath(),
+ "--filter_jar",
filterJar.getPath(),
- "--filter_source_jars",
+ "--filter_source_jar",
filterSrcJar.getPath(),
"--filtered_jar",
filteredJar.getPath(),