mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Update tests after testing with Java 21
This commit is contained in:
parent
edf2d33f84
commit
866fdb8af8
|
@ -197,34 +197,6 @@ public class BufferedWriterTest {
|
|||
BufferedWriter bWriter = new BufferedWriter(sw);
|
||||
char[] nullCharArray = null;
|
||||
|
||||
try {
|
||||
bWriter.write(nullCharArray, -1, -1);
|
||||
fail("should throw IndexOutOfBoundsException");
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
bWriter.write(nullCharArray, -1, 0);
|
||||
fail("should throw IndexOutOfBoundsException");
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
bWriter.write(nullCharArray, 0, -1);
|
||||
fail("should throw NullPointerException");
|
||||
} catch (NullPointerException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
bWriter.write(nullCharArray, 0, 0);
|
||||
fail("should throw NullPointerException");
|
||||
} catch (NullPointerException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
char[] testCharArray = testString.toCharArray();
|
||||
|
||||
bWriter.write(testCharArray, 0, 0);
|
||||
|
|
|
@ -560,7 +560,7 @@ public class BigDecimalConstructorsTest {
|
|||
new BigDecimal(a);
|
||||
fail("NumberFormatException expected");
|
||||
} catch (NumberFormatException e) {
|
||||
assertEquals("Improper exception message", "Scale out of range.", e.getMessage());
|
||||
// ok
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -437,15 +437,6 @@ public class URLTest {
|
|||
assertEquals(-1, u.getPort());
|
||||
assertEquals("test.html", u.getFile());
|
||||
assertEquals("foo", u.getRef());
|
||||
|
||||
// Strange behavior in reference, the hostname contains a ':' so it gets
|
||||
// wrapped in '[', ']'
|
||||
URL testURL = new URL("http", "www.apache.org:8080", "test.html#anch");
|
||||
assertEquals("wrong protocol", "http", testURL.getProtocol());
|
||||
assertEquals("wrong host", "[www.apache.org:8080]", testURL.getHost());
|
||||
assertEquals("wrong port", -1, testURL.getPort());
|
||||
assertEquals("wrong file", "test.html", testURL.getFile());
|
||||
assertEquals("wrong anchor", "anch", testURL.getRef());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -577,20 +568,12 @@ public class URLTest {
|
|||
@Test
|
||||
public void test_getFile() throws Exception {
|
||||
// Test for method java.lang.String java.net.URL.getFile()
|
||||
u = new URL("http", "www.yahoo.com:8080", 1233, "test/!@$%^&*/test.html#foo");
|
||||
u = new URL("http", "www.yahoo.com", 1233, "test/!@$%^&*/test.html#foo");
|
||||
assertEquals("returns a wrong file", "test/!@$%^&*/test.html", u.getFile());
|
||||
u = new URL("http", "www.yahoo.com:8080", 1233, "");
|
||||
u = new URL("http", "www.yahoo.com", 1233, "");
|
||||
assertTrue("returns a wrong file", u.getFile().equals(""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getHost() throws MalformedURLException {
|
||||
// Regression for HARMONY-60
|
||||
String ipv6Host = "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210";
|
||||
URL url = new URL("http", ipv6Host, -1, "myfile");
|
||||
assertEquals("[" + ipv6Host + "]", url.getHost());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getPort() throws Exception {
|
||||
// Test for method int java.net.URL.getPort()
|
||||
|
@ -643,15 +626,6 @@ public class URLTest {
|
|||
assertEquals("q1", testURL.getQuery());
|
||||
assertEquals("ref", testURL.getRef());
|
||||
|
||||
testURL = new URL("http", "u:p@home", 80, "/java?q1#ref");
|
||||
assertEquals("[u:p@home]:80", testURL.getAuthority());
|
||||
assertEquals("[u:p@home]", testURL.getHost());
|
||||
assertNull(testURL.getUserInfo());
|
||||
assertEquals("/java?q1", testURL.getFile());
|
||||
assertEquals("/java", testURL.getPath());
|
||||
assertEquals("q1", testURL.getQuery());
|
||||
assertEquals("ref", testURL.getRef());
|
||||
|
||||
testURL = new URL("http", "home", -1, "/java");
|
||||
assertEquals("wrong authority2", "home", testURL.getAuthority());
|
||||
assertNull("wrong userInfo2", testURL.getUserInfo());
|
||||
|
|
Loading…
Reference in New Issue
Block a user