public void testNullData() throws Exception { PublicKey publicKey = new PublicKey(); publicKey.toString(); boolean error = false; try { publicKey.writeBytes(new ByteArrayOutputStream()); } catch (DataFormatException dfe) { error = true; } assertTrue(error); }
public void testShortData() throws Exception { PublicKey publicKey = new PublicKey(); byte data[] = new byte[56]; for (int i = 0; i < data.length; i++) data[i] = (byte) (i); boolean error = false; try { publicKey.setData(data); publicKey.writeBytes(new ByteArrayOutputStream()); } catch (DataFormatException dfe) { error = true; } catch (IllegalArgumentException exc) { error = true; } assertTrue(error); }