use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class DkbPDFExtractorTest method testErtragsgutschriftDividendeQuellensteuern.
@Test
public void testErtragsgutschriftDividendeQuellensteuern() throws IOException {
DkbPDFExtractor extractor = new DkbPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DkbErtragsgutschriftDividendeQuellensteuern.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
// check security
Security security = assertSecurityErtragsgutschriftDividendeQuellensteuern(results);
// 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.getCurrencyCode(), is(CurrencyUnit.EUR));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2017-02-20T00:00")));
assertThat(transaction.getAmount(), is(2995L));
assertThat(transaction.getShares(), is(Values.Share.factorize(66)));
assertThat(transaction.getUnitSum(Unit.Type.TAX), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(5.29))));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class DkbPDFExtractorTest method testErtragsgutschriftZinsenAlt.
@Test
public void testErtragsgutschriftZinsenAlt() throws IOException {
DkbPDFExtractor extractor = new DkbPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DkbErtragsgutschriftAlt.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
// check security
Security security = assertSecurityErtragsgutschriftZinsgutschrift(results);
// 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.getCurrencyCode(), is(CurrencyUnit.EUR));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2014-01-02T00:00")));
assertThat(transaction.getAmount(), is(17302L));
assertThat(transaction.getShares(), is(Values.Share.factorize(100)));
assertThat(transaction.getUnitSum(Unit.Type.TAX), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(8.23))));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class DkbPDFExtractorTest method testErtragsgutschriftDividende.
@Test
public void testErtragsgutschriftDividende() throws IOException {
DkbPDFExtractor extractor = new DkbPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DkbErtragsgutschriftDividende.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
// check security
Security security = assertSecurityErtragsgutschriftDividende(results);
// 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.getCurrencyCode(), is(CurrencyUnit.EUR));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2016-04-07T00:00")));
assertThat(transaction.getAmount(), is(9750L));
assertThat(transaction.getShares(), is(Values.Share.factorize(30)));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testSteuertopfoptimierung.
@Test
public void testSteuertopfoptimierung() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexSteuertopfoptimierung.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(1));
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.TAX_REFUND));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2016-12-31T00:00")));
assertThat(transaction.getAmount(), is(Values.Amount.factorize(4.94)));
assertThat(transaction.getCurrencyCode(), is("EUR"));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testWertpapierKauf.
@Test
public void testWertpapierKauf() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexKauf.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(6));
new AssertImportActions().check(results, CurrencyUnit.EUR);
assertFirstSecurity(results.stream().filter(i -> i instanceof SecurityItem).findFirst());
assertFirstTransaction(results.stream().filter(i -> i instanceof BuySellEntryItem).findFirst());
assertSecondSecurity(//
results.stream().filter(i -> i instanceof SecurityItem).collect(Collectors.toList()).get(1));
assertSecondTransaction(results.stream().filter(i -> i instanceof BuySellEntryItem).collect(Collectors.toList()).get(1));
assertThirdTransaction(//
results.stream().filter(i -> i instanceof BuySellEntryItem).collect(Collectors.toList()).get(2));
assertFourthTransaction(//
results.stream().filter(i -> i instanceof TransactionItem).collect(Collectors.toList()).get(0));
}
Aggregations