### Question:
CsvLoaderUtils { static CurrencyAmount parseCurrencyAmountWithDirection( CsvRow row, String currencyField, String amountField, String directionField) { Currency currency = row.getValue(currencyField, LoaderUtils::parseCurrency); double amount = row.getValue(amountField, LoaderUtils::parseDouble); PayReceive direction = row.getValue(directionField, LoaderUtils::parsePayReceive); return CurrencyAmount.of(currency, direction.normalize(amount)); } private  CsvLoaderUtils(); static Pair<YearMonth, EtdVariant> parseEtdVariant(CsvRow row, EtdType type); static EtdSettlementType parseEtdSettlementType(String str); static EtdOptionType parseEtdOptionType(String str); static DoublesPair parseQuantity(CsvRow row); static String formattedPercentage(double value); static String formattedDouble(double value); static final String SECURITY_ID_SCHEME_FIELD; static final String SECURITY_ID_FIELD; static final String EXCHANGE_FIELD; static final String CONTRACT_CODE_FIELD; static final String LONG_QUANTITY_FIELD; static final String SHORT_QUANTITY_FIELD; static final String QUANTITY_FIELD; static final String PRICE_FIELD; static final String EXPIRY_FIELD; static final String EXPIRY_WEEK_FIELD; static final String EXPIRY_DAY_FIELD; static final String SETTLEMENT_TYPE_FIELD; static final String EXERCISE_STYLE_FIELD; static final String VERSION_FIELD; static final String PUT_CALL_FIELD; static final String EXERCISE_PRICE_FIELD; static final String UNDERLYING_EXPIRY_FIELD; static final String CURRENCY; static final String TICK_SIZE; static final String TICK_VALUE; static final String CONTRACT_SIZE; static final int DEFAULT_OPTION_VERSION_NUMBER; static final ImmutableMap<String, EtdSettlementType> SETTLEMENT_BY_CODE; }### Answer:
@Test public void test_parseCurrencyAmountWithDirection() { ImmutableList<String> headers = ImmutableList.of("CCY", "AMT", "DIR"); ImmutableList<String> firstRow = ImmutableList.of("GBP", "123.4", "Pay"); CsvRow row = CsvFile.of(headers, ImmutableList.of(firstRow)).row(0); assertThat(CsvLoaderUtils.parseCurrencyAmountWithDirection(row, "CCY", "AMT", "DIR")) .isEqualTo(CurrencyAmount.of(Currency.GBP, -123.4)); }
@Test public void test_parseCurrencyAmountWithDirection_notFound() { ImmutableList<String> headers = ImmutableList.of("CCY", "AMT", "DIR"); ImmutableList<String> firstRow = ImmutableList.of("GBP", "123.4", "Pay"); CsvRow row = CsvFile.of(headers, ImmutableList.of(firstRow)).row(0); assertThatIllegalArgumentException() .isThrownBy(() -> CsvLoaderUtils.parseCurrencyAmountWithDirection(row, "CCX", "AMT", "DIR")); }