use of name.abuchen.portfolio.model.AccountTransaction 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.model.AccountTransaction 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.model.AccountTransaction 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.model.AccountTransaction 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.model.AccountTransaction in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testDividendeAusland.
@Test
public void testDividendeAusland() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FinTechGroupBankDividendeAusland1.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("US8552441094"));
assertThat(security.getWkn(), is("884437"));
assertThat(security.getName(), is("STARBUCKS CORP."));
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-08-25T00:00")));
assertThat(transaction.getAmount(), is(Values.Amount.factorize(14.45)));
assertThat(transaction.getUnitSum(Unit.Type.TAX), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(7.78))));
assertThat(transaction.getShares(), is(Values.Share.factorize(105)));
}
Aggregations