/** * Parses the ETD settlement type from the short code or full name. * * @param str the string to parse * @return the settlement type * @throws IllegalArgumentException if the string cannot be parsed */ public static EtdSettlementType parseEtdSettlementType(String str) { String upper = str.toUpperCase(Locale.ENGLISH); EtdSettlementType fromCode = SETTLEMENT_BY_CODE.get(upper); return fromCode != null ? fromCode : EtdSettlementType.of(str); }
@Test(dataProvider = "name") public void test_of_lookup(EtdSettlementType convention, String name) { assertEquals(EtdSettlementType.of(name), convention); }
public void test_of_lookup_notFound() { assertThrows(() -> EtdSettlementType.of("Rubbish"), IllegalArgumentException.class); }
public void test_of_lookup_null() { assertThrows(() -> EtdSettlementType.of(null), IllegalArgumentException.class); }