### Question:
ISOAmount extends ISOComponent implements Cloneable, Externalizable { public void writeExternal (ObjectOutput out) throws IOException { out.writeShort (fieldNumber); try { out.writeUTF ((String) getValue()); } catch (ISOException e) { throw new IOException (e); } } ISOAmount();  ISOAmount(int fieldNumber);  ISOAmount(int fieldNumber, int currencyCode, BigDecimal amount); Object getKey(); Object getValue(); void setValue(Object obj); void setFieldNumber(int fieldNumber); @Override int getFieldNumber(); BigDecimal getAmount(); int getScale(); String getScaleAsString(); int getCurrencyCode(); String getCurrencyCodeAsString(); String getAmountAsLegacyString(); String getAmountAsString(); byte[] pack(); int unpack(byte[] b); void unpack(InputStream in); void dump(PrintStream p, String indent); void writeExternal(ObjectOutput out); void readExternal(ObjectInput in); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testBadWriteAttemptISOException() throws IOException { iSOAmount = new ISOAmount() { @Override public Object getValue() throws ISOException { throw new ISOException("boo!"); } }; ObjectOutput oo = mock(ObjectOutput.class); try { iSOAmount.writeExternal(oo); } catch (IOException ioe) { assertThat(ioe.getMessage(), is("org.jpos.iso.ISOException: boo!")); } }