public void testLongFileNamesCauseExceptionByDefault() {
ArArchiveOutputStream os = null;
try {
os = new ArArchiveOutputStream(new ByteArrayOutputStream());
final ArArchiveEntry ae = new ArArchiveEntry("this_is_a_long_name.txt",
0);
os.putArchiveEntry(ae);
fail("Expected an exception");
} catch (final IOException ex) {
assertTrue(ex.getMessage().startsWith("filename too long"));
} finally {
closeQuietly(os);
}
}
|