test/jdk/java/nio/Buffer/Basic-X.java.template
changeset 53959 1542e63eb537
parent 53855 7c362992527a
--- a/test/jdk/java/nio/Buffer/Basic-X.java.template	Thu Feb 28 10:04:27 2019 -0800
+++ b/test/jdk/java/nio/Buffer/Basic-X.java.template	Thu Feb 28 12:05:59 2019 -0800
@@ -648,7 +648,7 @@
             }
         }
 
-        // Exceptions in absolute bulk operations
+        // Exceptions in absolute bulk and slice operations
 
         catchNullArgument(b, () -> b.get(7, null, 0, 42));
         catchNullArgument(b, () -> b.put(7, ($type$[])null, 0, 42));
@@ -668,6 +668,11 @@
         catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
         catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
 
+        catchIndexOutOfBounds(b, () -> b.slice(-1, 7));
+        catchIndexOutOfBounds(b, () -> b.slice(b.limit() + 1, 7));
+        catchIndexOutOfBounds(b, () -> b.slice(0, -1));
+        catchIndexOutOfBounds(b, () -> b.slice(7, b.limit() - 7 + 1));
+
         // Values
 
         b.clear();
@@ -832,6 +837,20 @@
                  + sb.arrayOffset() + " != " + sb2.arrayOffset(), sb, sb2);
         }
 
+        int bPos = b.position();
+        int bLim = b.limit();
+
+        b.position(7);
+        b.limit(42);
+        $Type$Buffer rsb = b.slice();
+        b.position(0);
+        b.limit(b.capacity());
+        $Type$Buffer asb = b.slice(7, 35);
+        checkSlice(rsb, asb);
+
+        b.position(bPos);
+        b.limit(bLim);
+
 #if[byte]
 
         // Views