use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class DABPDFExtractorTest method testDividend.
@Test
public void testDividend() throws IOException {
DABPDFExtractor extractor = new DABPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DABDividend.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// check security
Security security = getSecurity(results);
assertThat(security.getIsin(), is("DE0005660104"));
assertThat(security.getName(), is("EUWAX AG Inhaber-Aktien o.N."));
assertThat(security.getCurrencyCode(), is(CurrencyUnit.EUR));
// check buy sell 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.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, 326_00)));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2014-07-02T00:00")));
assertThat(transaction.getShares(), is(Values.Share.factorize(100)));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class DABPDFExtractorTest method testDividendForeignCurrency.
@Test
public void testDividendForeignCurrency() throws IOException {
DABPDFExtractor extractor = new DABPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DABDividendForeignCurrency.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.USD);
// check security
Security security = getSecurity(results);
assertThat(security.getIsin(), is("US7427181091"));
assertThat(security.getName(), is("Procter & Gamble Co., The Registered Shares o.N."));
assertThat(security.getCurrencyCode(), is(CurrencyUnit.USD));
// check buy sell 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.getMonetaryAmount(), is(Money.of(CurrencyUnit.USD, 56_91)));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2015-05-16T00:00")));
assertThat(transaction.getShares(), is(Values.Share.factorize(100)));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class DABPDFExtractorTest method testDividend3.
@Test
public void testDividend3() throws IOException {
DABPDFExtractor extractor = new DABPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DABDividend3.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// check security
Security security = getSecurity(results);
assertThat(security.getIsin(), is("CH0012032048"));
assertThat(security.getName(), is("Roche Holding AG Inhaber-Genußscheineo.N."));
assertThat(security.getCurrencyCode(), is("CHF"));
// check buy sell 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.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(82.92))));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2006-03-02T00:00")));
assertThat(transaction.getShares(), is(Values.Share.factorize(80)));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class DABPDFExtractorTest method testDividend6.
@Test
public void testDividend6() throws IOException {
DABPDFExtractor extractor = new DABPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DABDividend6.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// check security
Security security = getSecurity(results);
assertThat(security.getIsin(), is("DE0006483001"));
assertThat(security.getName(), is("Linde AG Inhaber-Aktien o.N."));
assertThat(security.getCurrencyCode(), is(CurrencyUnit.EUR));
// check buy sell 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.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(198.79))));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2013-05-31T00:00")));
assertThat(transaction.getShares(), is(Values.Share.factorize(100)));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class DABPDFExtractorTest method testDividend4.
@Test
public void testDividend4() throws IOException {
DABPDFExtractor extractor = new DABPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DABDividend4.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// check security
Security security = getSecurity(results);
assertThat(security.getIsin(), is("US7033951036"));
assertThat(security.getName(), is("Patterson Companies Inc. Registered Shares DL -,01"));
assertThat(security.getCurrencyCode(), is(CurrencyUnit.USD));
// check buy sell 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.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(80.92))));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2016-07-29T00:00")));
assertThat(transaction.getShares(), is(Values.Share.factorize(500)));
}
Aggregations