aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Chang <vichang@google.com>2022-05-04 17:45:46 +0100
committerVictor Chang <vichang@google.com>2022-05-10 11:30:15 +0000
commit8fb5c96082bbc9d37a2d1c463cc77fc0ad27fc7d (patch)
tree5d94586b9f5ef2369a7168393055c9e5d8638255
parenta3e02c43fd1d59be1c65ec5ef8e6e1ac0d4bb709 (diff)
downloadlibcore-8fb5c96082bbc9d37a2d1c463cc77fc0ad27fc7d.tar.gz
Add more test for MalformedURLException
Bug: 119393918 Bug: 182166637 Test: atest CtsLibcoreTestCases: libcore.java.net.MalformedURLExceptionTest Change-Id: I0468bca33e2e09c6cea4ecb1d0c14d9b30273329 (cherry picked from commit ffd7713ba77f27a0ae9d736cf50cbdda1756d26c) Merged-In: I0468bca33e2e09c6cea4ecb1d0c14d9b30273329
-rw-r--r--luni/src/test/java/libcore/java/net/MalformedURLExceptionTest.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/luni/src/test/java/libcore/java/net/MalformedURLExceptionTest.java b/luni/src/test/java/libcore/java/net/MalformedURLExceptionTest.java
index b9998da9a40..b60b7b8b9aa 100644
--- a/luni/src/test/java/libcore/java/net/MalformedURLExceptionTest.java
+++ b/luni/src/test/java/libcore/java/net/MalformedURLExceptionTest.java
@@ -17,6 +17,7 @@
package libcore.java.net;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import java.net.MalformedURLException;
@@ -28,8 +29,12 @@ import org.junit.runners.JUnit4;
public class MalformedURLExceptionTest {
@Test
- public void testEmptyConstructor() {
+ public void testConstructor() {
MalformedURLException e = new MalformedURLException();
assertNull(e.getMessage());
+
+ String msg = "x:yyy is not valid URL";
+ e = new MalformedURLException(msg);
+ assertEquals(msg, e.getMessage());
}
}