/** * Loads one or more CSV format position files. * <p> * CSV files sometimes contain a Unicode Byte Order Mark. * This method uses {@link UnicodeBom} to interpret it. * * @param resources the CSV resources * @return the loaded positions, position-level errors are captured in the result */ public ValueWithFailures<List<Position>> load(ResourceLocator... resources) { return load(Arrays.asList(resources)); }
public void test_load_genericSecurity() { PositionCsvLoader test = PositionCsvLoader.standard(); ValueWithFailures<List<Position>> trades = test.load(FILE); List<GenericSecurityPosition> filtered = trades.getValue().stream() .flatMap(filtering(GenericSecurityPosition.class)) .collect(toImmutableList()); assertEquals(filtered.size(), 1); assertBeanEquals(SECURITY3FULL, filtered.get(0)); }
public void test_load_security() { PositionCsvLoader test = PositionCsvLoader.standard(); ValueWithFailures<List<Position>> trades = test.load(FILE); List<SecurityPosition> filtered = trades.getValue().stream() .flatMap(filtering(SecurityPosition.class)) .collect(toImmutableList()); assertEquals(filtered.size(), 2); assertBeanEquals(SECURITY1, filtered.get(0)); assertBeanEquals(SECURITY2, filtered.get(1)); }