@Test public void testSetValueBadLength() { try { iSOAmount.setValue("1234"); fail("expected invalid length ISOException"); } catch (ISOException e) { assertThat(e.getMessage(), is("ISOAmount invalid length 4")); } }
public void setValue (Object obj) throws ISOException { if (obj instanceof String) { String s = (String) obj; if (s.length() < 12) { throw new ISOException ( "ISOAmount invalid length " + s.length() ); } try { currencyCode = Integer.parseInt (s.substring(0,3)); int dec = Integer.parseInt (s.substring(3,4)); amount = new BigDecimal (s.substring(4)).movePointLeft (dec); value = s; } catch (NumberFormatException e) { throw new ISOException (e.getMessage()); } } }
ISOAmount extends ISOComponent implements Cloneable, Externalizable { public void setValue (Object obj) throws ISOException { if (obj instanceof String) { String s = (String) obj; if (s.length() < 12) { throw new ISOException ( "ISOAmount invalid length " + s.length() ); } try { currencyCode = Integer.parseInt (s.substring(0,3)); int dec = Integer.parseInt (s.substring(3,4)); amount = new BigDecimal (s.substring(4)).movePointLeft (dec); value = s; } catch (NumberFormatException e) { throw new ISOException (e.getMessage()); } } } }
ISOAmount extends ISOComponent implements Cloneable, Externalizable { public void setValue (Object obj) throws ISOException { if (obj instanceof String) { String s = (String) obj; if (s.length() < 12) { throw new ISOException ( "ISOAmount invalid length " + s.length() ); } try { currencyCode = Integer.parseInt (s.substring(0,3)); int dec = Integer.parseInt (s.substring(3,4)); amount = new BigDecimal (s.substring(4)).movePointLeft (dec); value = s; } catch (NumberFormatException e) { throw new ISOException (e.getMessage()); } } } ISOAmount();  ISOAmount(int fieldNumber);  ISOAmount(int fieldNumber, int currencyCode, BigDecimal amount); }
ISOAmount extends ISOComponent implements Cloneable, Externalizable { public void setValue (Object obj) throws ISOException { if (obj instanceof String) { String s = (String) obj; if (s.length() < 12) { throw new ISOException ( "ISOAmount invalid length " + s.length() ); } try { currencyCode = Integer.parseInt (s.substring(0,3)); int dec = Integer.parseInt (s.substring(3,4)); amount = new BigDecimal (s.substring(4)).movePointLeft (dec); value = s; } catch (NumberFormatException e) { throw new ISOException (e.getMessage()); } } } 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(); }
ISOAmount extends ISOComponent implements Cloneable, Externalizable { public void setValue (Object obj) throws ISOException { if (obj instanceof String) { String s = (String) obj; if (s.length() < 12) { throw new ISOException ( "ISOAmount invalid length " + s.length() ); } try { currencyCode = Integer.parseInt (s.substring(0,3)); int dec = Integer.parseInt (s.substring(3,4)); amount = new BigDecimal (s.substring(4)).movePointLeft (dec); value = s; } catch (NumberFormatException e) { throw new ISOException (e.getMessage()); } } } 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();  }