summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2018-11-28 10:54:48 +0000
committer Vladimir Marko <vmarko@google.com> 2018-11-28 10:58:00 +0000
commitcb64b85d581fc207688603fbca3770fb4bb0d008 (patch)
tree075468eb42783125937f0143e2a5eb7da0bfd8f0
parent201330ccfb11989f7449486865c6f74b54f1a914 (diff)
Remove bouncycastle dependency from 021-string2.
The part of the test 021-string2 using bouncycastle was added with the String representation change, https://android-review.googlesource.com/79174 , but the only thing it seems to be testing (with respect to that CL) is the String(char[]) constructor. Therefore, change the test to call that constructor directly. Test: testrunner.py --host -t 021-string2 Change-Id: Ifbac88609ffc190d577d48880a451d2279c2a078
-rw-r--r--test/021-string2/src/Main.java7
1 files changed, 2 insertions, 5 deletions
diff --git a/test/021-string2/src/Main.java b/test/021-string2/src/Main.java
index c713aa43a6..141a08983b 100644
--- a/test/021-string2/src/Main.java
+++ b/test/021-string2/src/Main.java
@@ -15,14 +15,13 @@
*/
import junit.framework.Assert;
-import java.lang.reflect.Method;
import java.util.Locale;
/**
* more string tests
*/
public class Main {
- public static void main(String args[]) throws Exception {
+ public static void main(String args[]) {
String test = "0123456789";
String test1 = new String("0123456789"); // different object
String test2 = new String("0123456780"); // different value
@@ -86,9 +85,7 @@ public class Main {
Assert.assertEquals("this is a path", test.replaceAll("/", " "));
Assert.assertEquals("this is a path", test.replace("/", " "));
- Class<?> Strings = Class.forName("com.android.org.bouncycastle.util.Strings");
- Method fromUTF8ByteArray = Strings.getDeclaredMethod("fromUTF8ByteArray", byte[].class);
- String result = (String) fromUTF8ByteArray.invoke(null, new byte[] {'O', 'K'});
+ String result = new String(new char[] { 'O', 'K' });
System.out.println(result);
testCompareToAndEquals();