Update String.repeat backport test
Add a test for generationg a Sting which exceeds the maximum size of
a java String.
Bug: 204183618
Change-Id: Id692c7245e988d07fe73e32d781e248c88fe7306
diff --git a/src/test/examplesJava11/backport/StringBackportJava11Main.java b/src/test/examplesJava11/backport/StringBackportJava11Main.java
index 6af33fa..14d4d42 100644
--- a/src/test/examplesJava11/backport/StringBackportJava11Main.java
+++ b/src/test/examplesJava11/backport/StringBackportJava11Main.java
@@ -25,6 +25,13 @@
assertEquals("heyhey", "hey".repeat(2));
assertEquals("heyheyhey", "hey".repeat(3));
assertEquals("heyheyheyhey", "hey".repeat(4));
+
+ try {
+ "\u03B1\u03B2".repeat(Integer.MAX_VALUE);
+ throw new AssertionError("Expected to throw NegativeArraySizeException");
+ } catch (NegativeArraySizeException e) {
+ // TODO(b/204183618): Should throw OOM.
+ }
}
/** Per {@link Character#isWhitespace(int)} */