use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class DeutscheBankPDFExtractorTest method testErtragsgutschrift2.
@Test
public void testErtragsgutschrift2() throws IOException {
DeutscheBankPDFExtractor extractor = new DeutscheBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DeutscheBankErtragsgutschrift2.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// check security
Security security = results.stream().filter(i -> i instanceof SecurityItem).findFirst().get().getSecurity();
assertThat(security.getName(), is("ISHS-MSCI N. AMERIC.UCITS ETF BE.SH.(DT.ZT.)"));
assertThat(security.getIsin(), is("DE000A0J2060"));
assertThat(security.getWkn(), is("A0J206"));
assertThat(security.getCurrencyCode(), is("USD"));
// check transaction
Optional<Item> item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(AccountTransaction.class));
AccountTransaction transaction = (AccountTransaction) item.get().getSubject();
assertThat(transaction.getType(), is(AccountTransaction.Type.DIVIDENDS));
assertThat(transaction.getSecurity(), is(security));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2015-03-24T00:00")));
assertThat(transaction.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, 16_17L)));
assertThat(transaction.getShares(), is(Values.Share.factorize(123)));
Optional<Unit> grossValue = transaction.getUnit(Unit.Type.GROSS_VALUE);
assertThat(grossValue.isPresent(), is(true));
assertThat(grossValue.get().getAmount(), is(Money.of("EUR", 16_17L)));
assertThat(grossValue.get().getForex(), is(Money.of("USD", 17_38L)));
assertThat(grossValue.get().getExchangeRate().doubleValue(), IsCloseTo.closeTo(0.930578, 0.000001));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testErtragsgutschrift.
@Test
public void testErtragsgutschrift() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexErtragsgutschrift.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// security
Optional<Item> item = results.stream().filter(i -> i instanceof SecurityItem).findFirst();
assertThat(item.isPresent(), is(true));
Security security = ((SecurityItem) item.get()).getSecurity();
assertThat(security.getIsin(), is("DE0008402215"));
assertThat(security.getWkn(), is("840221"));
assertThat(security.getName(), is("HANN.RUECK SE NA O.N."));
assertThat(security.getCurrencyCode(), is(CurrencyUnit.EUR));
item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(AccountTransaction.class));
AccountTransaction transaction = (AccountTransaction) item.get().getSubject();
assertThat(transaction.getType(), is(AccountTransaction.Type.DIVIDENDS));
assertThat(transaction.getSecurity(), is(security));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2014-05-08T00:00")));
assertThat(transaction.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, 795_15L)));
assertThat(transaction.getShares(), is(Values.Share.factorize(360)));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testWertpapierBestandsausbuchung.
@Test
public void testWertpapierBestandsausbuchung() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexBestandsausbuchung.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(6));
new AssertImportActions().check(results, CurrencyUnit.EUR);
assertFirstSecurityBestandsausbuchung(results.stream().filter(i -> i instanceof SecurityItem).findFirst());
assertFirstTransactionBestandsausbuchung(results.stream().filter(i -> i instanceof BuySellEntryItem).findFirst());
assertSecondSecurityBestandsausbuchung(//
results.stream().filter(i -> i instanceof SecurityItem).collect(Collectors.toList()).get(1));
assertSecondTransactionBestandsausbuchung(results.stream().filter(i -> i instanceof BuySellEntryItem).collect(Collectors.toList()).get(1));
assertThirdSecurityBestandsausbuchung(//
results.stream().filter(i -> i instanceof SecurityItem).collect(Collectors.toList()).get(2));
assertThirdTransactionBestandsausbuchung(results.stream().filter(i -> i instanceof BuySellEntryItem).collect(Collectors.toList()).get(2));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class CommerzbankPDFExtractorTest method testErtragsgutschrift.
@Test
public void testErtragsgutschrift() throws IOException {
CommerzbankPDFExtractor extractor = new CommerzbankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "CommerzbankErtragsgutschrift.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// check security
Security security = results.stream().filter(i -> i instanceof SecurityItem).findAny().get().getSecurity();
assertThat(security.getName(), is("iShs-MSCI N . America UCITS ETF"));
assertThat(security.getIsin(), is("DE000A0J2060"));
assertThat(security.getWkn(), is("A0J206"));
assertThat(security.getCurrencyCode(), is(CurrencyUnit.EUR));
// check transaction
Optional<Item> item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(AccountTransaction.class));
AccountTransaction transaction = (AccountTransaction) item.get().getSubject();
assertThat(transaction.getType(), is(AccountTransaction.Type.DIVIDENDS));
assertThat(transaction.getSecurity(), is(security));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2015-06-22T00:00")));
assertThat(transaction.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, 223_45L)));
assertThat(transaction.getShares(), is(Values.Share.factorize(123)));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class CommerzbankPDFExtractorTest method testErtragsgutschrift2.
@Test
public void testErtragsgutschrift2() throws IOException {
CommerzbankPDFExtractor extractor = new CommerzbankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "CommerzbankErtragsgutschrift2.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// check security
Security security = results.stream().filter(i -> i instanceof SecurityItem).findAny().get().getSecurity();
assertThat(security.getName(), is("iShares-MSCI Japan UETF DIS"));
assertThat(security.getIsin(), is("DE000A0DPMW9"));
assertThat(security.getWkn(), is("A0DPMW"));
assertThat(security.getCurrencyCode(), is(CurrencyUnit.EUR));
// check transaction
Optional<Item> item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(AccountTransaction.class));
AccountTransaction transaction = (AccountTransaction) item.get().getSubject();
assertThat(transaction.getType(), is(AccountTransaction.Type.DIVIDENDS));
assertThat(transaction.getSecurity(), is(security));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2015-07-20T00:00")));
assertThat(transaction.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, 1045_67L)));
assertThat(transaction.getShares(), is(Values.Share.factorize(1234)));
}
Aggregations