use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testGutschriftsBelastungsanzeige.
@Test
public void testGutschriftsBelastungsanzeige() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexGutschriftsBelastungsanzeige.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(20));
Optional<Item> item;
// security
item = results.stream().filter(i -> i instanceof SecurityItem).findFirst();
assertThat(item.isPresent(), is(true));
Security security = ((SecurityItem) item.get()).getSecurity();
assertThat(security.getIsin(), is("DE0008474503"));
assertThat(security.getName(), is("DEKAFONDS CF"));
item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(PortfolioTransaction.class));
PortfolioTransaction entry = (PortfolioTransaction) item.get().getSubject();
assertThat(entry.getType(), is(PortfolioTransaction.Type.DELIVERY_INBOUND));
assertThat(entry.getAmount(), is(Values.Amount.factorize(5.50)));
assertThat(entry.getDateTime(), is(LocalDateTime.parse("2015-02-16T00:00")));
assertThat(entry.getShares(), is(Values.Share.factorize(0.0520)));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testWertpapierĂbertrag2.
@Test
public void testWertpapierĂbertrag2() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexDepoteingang2.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
Optional<Item> item;
// security
item = results.stream().filter(i -> i instanceof SecurityItem).findFirst();
assertThat(item.isPresent(), is(true));
Security security = ((SecurityItem) item.get()).getSecurity();
assertThat(security.getIsin(), is("DE000US9RGR9"));
assertThat(security.getName(), is("UBS AG LONDON 14/16 RWE"));
item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(PortfolioTransaction.class));
PortfolioTransaction entry = (PortfolioTransaction) item.get().getSubject();
assertThat(entry.getType(), is(PortfolioTransaction.Type.DELIVERY_INBOUND));
assertThat(entry.getAmount(), is(Values.Amount.factorize(7517.50)));
assertThat(entry.getDateTime(), is(LocalDateTime.parse("2015-11-24T00:00")));
assertThat(entry.getShares(), is(Values.Share.factorize(250)));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testErtragsgutschrift3.
@Test
public void testErtragsgutschrift3() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexErtragsgutschrift3.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
// 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("DE0006335003"));
assertThat(security.getWkn(), is("633500"));
assertThat(security.getName(), is("KRONES AG O.N."));
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("2017-06-23T00:00")));
assertThat(transaction.getAmount(), is(Values.Amount.factorize(17.13)));
assertThat(transaction.getUnitSum(Unit.Type.TAX), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(6.12))));
assertThat(transaction.getShares(), is(Values.Share.factorize(15)));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem 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.Extractor.TransactionItem 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