public void test_parseBoolean() { assertEquals(LoaderUtils.parseBoolean("TRUE"), true); assertEquals(LoaderUtils.parseBoolean("True"), true); assertEquals(LoaderUtils.parseBoolean("true"), true); assertEquals(LoaderUtils.parseBoolean("t"), true); assertEquals(LoaderUtils.parseBoolean("yes"), true); assertEquals(LoaderUtils.parseBoolean("y"), true); assertEquals(LoaderUtils.parseBoolean("FALSE"), false); assertEquals(LoaderUtils.parseBoolean("False"), false); assertEquals(LoaderUtils.parseBoolean("false"), false); assertEquals(LoaderUtils.parseBoolean("f"), false); assertEquals(LoaderUtils.parseBoolean("no"), false); assertEquals(LoaderUtils.parseBoolean("n"), false); assertThrowsIllegalArg(() -> LoaderUtils.parseBoolean("Rubbish")); }
.map(s -> LoaderUtils.parseBoolean(s)) .ifPresent(v -> builder.initialExchange(v)); findValue(row, leg, NOTIONAL_INTERMEDIATE_EXCHANGE_FIELD) .map(s -> LoaderUtils.parseBoolean(s)) .ifPresent(v -> builder.intermediateExchange(v)); findValue(row, leg, NOTIONAL_FINAL_EXCHANGE_FIELD) .map(s -> LoaderUtils.parseBoolean(s)) .ifPresent(v -> builder.finalExchange(v)); return builder.build();
public void test_parseBuySell() { assertEquals(LoaderUtils.parseBuySell("BUY"), BuySell.BUY); assertEquals(LoaderUtils.parseBuySell("Buy"), BuySell.BUY); assertEquals(LoaderUtils.parseBuySell("buy"), BuySell.BUY); assertEquals(LoaderUtils.parseBuySell("b"), BuySell.BUY); assertEquals(LoaderUtils.parseBuySell("SELL"), BuySell.SELL); assertEquals(LoaderUtils.parseBuySell("Sell"), BuySell.SELL); assertEquals(LoaderUtils.parseBuySell("sell"), BuySell.SELL); assertEquals(LoaderUtils.parseBuySell("s"), BuySell.SELL); assertThrowsIllegalArg(() -> LoaderUtils.parseBoolean("Rubbish")); }
public void test_parsePayReceive() { assertEquals(LoaderUtils.parsePayReceive("PAY"), PayReceive.PAY); assertEquals(LoaderUtils.parsePayReceive("Pay"), PayReceive.PAY); assertEquals(LoaderUtils.parsePayReceive("pay"), PayReceive.PAY); assertEquals(LoaderUtils.parsePayReceive("p"), PayReceive.PAY); assertEquals(LoaderUtils.parsePayReceive("RECEIVE"), PayReceive.RECEIVE); assertEquals(LoaderUtils.parsePayReceive("Receive"), PayReceive.RECEIVE); assertEquals(LoaderUtils.parsePayReceive("receive"), PayReceive.RECEIVE); assertEquals(LoaderUtils.parsePayReceive("rec"), PayReceive.RECEIVE); assertEquals(LoaderUtils.parsePayReceive("r"), PayReceive.RECEIVE); assertThrowsIllegalArg(() -> LoaderUtils.parseBoolean("Rubbish")); }
public void test_parsePutCall() { assertEquals(LoaderUtils.parsePutCall("PUT"), PutCall.PUT); assertEquals(LoaderUtils.parsePutCall("Put"), PutCall.PUT); assertEquals(LoaderUtils.parsePutCall("put"), PutCall.PUT); assertEquals(LoaderUtils.parsePutCall("p"), PutCall.PUT); assertEquals(LoaderUtils.parsePutCall("CALL"), PutCall.CALL); assertEquals(LoaderUtils.parsePutCall("Call"), PutCall.CALL); assertEquals(LoaderUtils.parsePutCall("call"), PutCall.CALL); assertEquals(LoaderUtils.parsePutCall("c"), PutCall.CALL); assertThrowsIllegalArg(() -> LoaderUtils.parseBoolean("Rubbish")); }