use of name.abuchen.portfolio.model.Security in project portfolio by buchen.
the class DkbPDFExtractorPDFTest method testErtragsgutschriftDividende.
@Test
public void testErtragsgutschriftDividende() throws IOException {
DkbPDFExtractor extractor = new DkbPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
URL url = FileLocator.resolve(getClass().getResource("DkBErtragsgutschrift2_GBP_Freibetrrag_ausgeschoepft.pdf"));
PDFInputFile inputFile = new PDFInputFile(new File(url.getPath()));
inputFile.parse();
List<Item> results = extractor.extract(Arrays.asList(inputFile), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
// check security
Security security = results.stream().filter(i -> i instanceof SecurityItem).findFirst().get().getSecurity();
assertThat(security.getWkn(), is("A0DJ58"));
assertThat(security.getIsin(), is("GB00B02J6398"));
assertThat(security.getName(), is("ADMIRAL GROUP PLC"));
// 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("2015-10-13T00:00")));
assertThat(transaction.getMonetaryAmount(), is(Money.of("EUR", 227_63L)));
assertThat(transaction.getShares(), is(Values.Share.factorize(450)));
}
use of name.abuchen.portfolio.model.Security in project portfolio by buchen.
the class DkbPDFExtractorTest method assertSecurityErtragsgutschriftZinsgutschrift.
private Security assertSecurityErtragsgutschriftZinsgutschrift(List<Item> results) {
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("DE000A1R1AN5"));
assertThat(security.getWkn(), is("A1R1AN"));
assertThat(security.getName(), is("PCC SE"));
return security;
}
use of name.abuchen.portfolio.model.Security in project portfolio by buchen.
the class DkbPDFExtractorTest method assertSecurityRueckzahlung.
private Security assertSecurityRueckzahlung(List<Item> results) {
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("XS0149161217"));
assertThat(security.getWkn(), is("858865"));
assertThat(security.getName(), is("2,309 % RBS CAPITAL TRUST A"));
return security;
}
use of name.abuchen.portfolio.model.Security in project portfolio by buchen.
the class DkbPDFExtractorTest method assertSecurityBuyAktien.
private Security assertSecurityBuyAktien(List<Item> results) {
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("BMG7945E1057"));
assertThat(security.getWkn(), is("A0ERZ0"));
assertThat(security.getName(), is("SEADRILL LTD."));
return security;
}
use of name.abuchen.portfolio.model.Security in project portfolio by buchen.
the class DkbPDFExtractorTest method testInvestmentertraege.
@Test
public void testInvestmentertraege() throws IOException {
DkbPDFExtractor extractor = new DkbPDFExtractor(new Client());
List<Exception> errors = new ArrayList<>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DkbInvestmentertraege.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
// check 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("IE00B6YX5D40"));
assertThat(security.getWkn(), is("A1JKS0"));
assertThat(security.getName(), is("SPDR S&P US DIVID.ARISTOCR.ETF"));
assertThat(security.getCurrencyCode(), is("USD"));
// check 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();
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-10-04T00:00")));
assertThat(transaction.getAmount(), is(Values.Amount.factorize(2.09)));
assertThat(transaction.getShares(), is(Values.Share.factorize(10.6841)));
assertThat(transaction.getUnitSum(Unit.Type.TAX), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(0.39))));
}
Aggregations