UnorderedCurrencyPair implements ImmutableBean,
    UniqueIdentifiable, ObjectIdentifiable, Serializable { @FromString public static UnorderedCurrencyPair parse(final String pairStr) { ArgumentChecker.notNull(pairStr, "pairStr"); if (pairStr.length() != 6) { throw new IllegalArgumentException("Unable to parse amount, invalid format: " + pairStr); } try { Currency cur1 = Currency.parse(pairStr.substring(0, 3)); Currency cur2 = Currency.parse(pairStr.substring(3)); return new UnorderedCurrencyPair(cur1, cur2); } catch (RuntimeException ex) { throw new IllegalArgumentException("Unable to parse pair: " + pairStr, ex); } } @ImmutableConstructor private  UnorderedCurrencyPair(Currency currency1, Currency currency2); static UnorderedCurrencyPair of(Currency ccy1, Currency ccy2); static UnorderedCurrencyPair of(UniqueId uniqueId); @FromString static UnorderedCurrencyPair parse(final String pairStr); Currency getFirstCurrency(); Currency getSecondCurrency(); @Override ObjectId getObjectId(); @Override UniqueId getUniqueId(); @Override boolean equals(Object obj); @Override int hashCode(); @Override @ToString String toString(); static UnorderedCurrencyPair.Meta meta(); @Override UnorderedCurrencyPair.Meta metaBean(); @Override Property<R> property(String propertyName); @Override Set<String> propertyNames(); static final String OBJECT_SCHEME; }
@Test(dataProvider = "badParse", expectedExceptions = IllegalArgumentException.class) public void test_parse_String_bad(String input) { UnorderedCurrencyPair.parse(input); }