test/java/lang/StringBuffer/Exceptions.java

Print this page

        

*** 92,117 **** new StringBuffer("foo"); }}); System.out.println("StringBuffer.replace(int start, int end, String str)"); tryCatch(" -1, 2, \" \"", ! new StringIndexOutOfBoundsException(-1), new Runnable() { public void run() { StringBuffer sb = new StringBuffer("hilbert"); sb.replace(-1, 2, " "); }}); tryCatch(" 7, 8, \" \"", ! new StringIndexOutOfBoundsException("start > length()"), new Runnable() { public void run() { StringBuffer sb = new StringBuffer("banach"); sb.replace(7, 8, " "); }}); tryCatch(" 2, 1, \" \"", ! new StringIndexOutOfBoundsException("start > end"), new Runnable() { public void run() { StringBuffer sb = new StringBuffer("riemann"); sb.replace(2, 1, " "); }}); --- 92,117 ---- new StringBuffer("foo"); }}); System.out.println("StringBuffer.replace(int start, int end, String str)"); tryCatch(" -1, 2, \" \"", ! new StringIndexOutOfBoundsException("start -1, end 2, length 7"), new Runnable() { public void run() { StringBuffer sb = new StringBuffer("hilbert"); sb.replace(-1, 2, " "); }}); tryCatch(" 7, 8, \" \"", ! new StringIndexOutOfBoundsException("start 7, end 6, length 6"), new Runnable() { public void run() { StringBuffer sb = new StringBuffer("banach"); sb.replace(7, 8, " "); }}); tryCatch(" 2, 1, \" \"", ! new StringIndexOutOfBoundsException("start 2, end 1, length 7"), new Runnable() { public void run() { StringBuffer sb = new StringBuffer("riemann"); sb.replace(2, 1, " "); }});