/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @bug 7006126
* @summary Unit test for methods for Files readAllBytes, readAllLines and
* and write methods.
*/
public class BytesAndLines {
}
/**
* Test readAllBytes(Path) and write(Path, byte[], OpenOption...)
*/
// exercise methods with various sizes
for (int i=0; i<100; i++) {
}
// NullPointerException
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
}
try {
// write method should create file if it doesn't exist
if (rand.nextBoolean())
// write bytes to file
// append bytes to file (might be 0 bytes)
// read entire file
// check bytes are correct
byte[] expected;
if (append) {
} else {
}
"Bytes read not the same as bytes written");
} finally {
}
}
/**
* Test readAllLines(Path,Charset)
*/
try {
// zero lines
// one line
// two lines using platform's line separator
// MalformedInputException
try {
throw new RuntimeException("MalformedInputException expected");
} catch (MalformedInputException ignore) { }
// NullPointerException
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
} finally {
}
}
/**
* Test write(Path,Iterable<? extends CharSequence>,Charset,OpenOption...)
*/
try {
// write method should create file if it doesn't exist
if (rand.nextBoolean())
// zero lines
// two lines
// append two lines
// UnmappableCharacterException
try {
String s = "\u00A0\u00A1";
throw new RuntimeException("UnmappableCharacterException expected");
} catch (UnmappableCharacterException ignore) { }
// NullPointerException
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
} finally {
}
}
if (!expr)
throw new RuntimeException(errmsg);
}
}