use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem 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)));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class BaaderBankPDFExtractorTest method testSteuerausgleichsrechnung.
@Test
public void testSteuerausgleichsrechnung() throws IOException {
BaaderBankPDFExtractor extractor = new BaaderBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "BaaderBankSteuerausgleichsrechnung1.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(1));
// get 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();
// assert transaction
assertThat(transaction.getType(), is(AccountTransaction.Type.TAX_REFUND));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2017-06-22T00:00")));
assertThat(transaction.getAmount(), is(Values.Amount.factorize(9.01)));
assertThat(transaction.getCurrencyCode(), is(CurrencyUnit.EUR));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class BaaderBankPDFExtractorTest method testErtragsthesaurierung1.
@Test
public void testErtragsthesaurierung1() throws IOException {
BaaderBankPDFExtractor extractor = new BaaderBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "BaaderBankErtragsthesaurierung1.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
Optional<Item> item = results.stream().filter(i -> i instanceof SecurityItem).findFirst();
// get security
assertThat(item.isPresent(), is(true));
Security security = ((SecurityItem) item.get()).getSecurity();
// assert security
assertThat(security.getIsin(), is("DE0005933931"));
assertThat(security.getWkn(), is("593393"));
// get transaction
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();
// assert transaction
assertThat(transaction.getType(), is(AccountTransaction.Type.DIVIDENDS));
assertThat(transaction.getSecurity(), is(security));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2017-05-12T00:00")));
assertThat(transaction.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(1.24))));
assertThat(transaction.getShares(), is(Values.Share.factorize(11)));
assertThat(transaction.getUnitSum(Unit.Type.TAX), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(4.63))));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class BaaderBankPDFExtractorTest method testRechnung1.
@Test
public void testRechnung1() throws IOException {
BaaderBankPDFExtractor extractor = new BaaderBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "BaaderBankRechnung1.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(1));
new AssertImportActions().check(results, CurrencyUnit.EUR);
Optional<Item> item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
// get transaction
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(AccountTransaction.class));
AccountTransaction transaction = (AccountTransaction) item.get().getSubject();
// assert transaction
assertThat(transaction.getType(), is(AccountTransaction.Type.FEES));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2017-08-02T00:00")));
assertThat(transaction.getAmount(), is(Values.Amount.factorize(6.48)));
assertThat(transaction.getCurrencyCode(), is(CurrencyUnit.EUR));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class BankSLMPDFExtractorTest method testDividende_Ausland1.
@Test
public void testDividende_Ausland1() throws IOException {
BankSLMPDFExtractor extractor = new BankSLMPDFExtractor(new Client());
List<Exception> errors = new ArrayList<>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "BankSLM_Dividende_Ausland1.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, "CHF");
// check security
Security security = results.stream().filter(i -> i instanceof SecurityItem).findFirst().get().getSecurity();
assertThat(security.getWkn(), is("472672"));
assertThat(security.getName(), is("Nokia Corp"));
// 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("2016-07-05T00:00")));
assertThat(transaction.getMonetaryAmount(), is(Money.of("CHF", 3302_00L)));
assertThat(transaction.getUnitSum(Unit.Type.TAX), is(Money.of("CHF", 1415_14L)));
assertThat(transaction.getGrossValue(), is(Money.of("CHF", 4717_14L)));
assertThat(transaction.getShares(), is(Values.Share.factorize(17000)));
}
Aggregations