use of name.abuchen.portfolio.model.PortfolioTransaction in project portfolio by buchen.
the class OnvistaPDFExtractorTest method testEinbuchungDividendenRechte.
@Test
public void testEinbuchungDividendenRechte() throws IOException {
OnvistaPDFExtractor extractor = new OnvistaPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "OnvistaEinbuchungDividendenRechte.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
assertSecurityEinAusbuchungDividendenRechte(results);
// check delivery transaction
Optional<Item> item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(PortfolioTransaction.class));
PortfolioTransaction entry = (PortfolioTransaction) item.get().getSubject();
assertThat(entry.getType(), is(PortfolioTransaction.Type.DELIVERY_INBOUND));
assertThat(entry.getDateTime(), is(is(LocalDateTime.parse("2016-05-25T00:00"))));
assertThat(entry.getShares(), is(Values.Share.factorize(25)));
}
use of name.abuchen.portfolio.model.PortfolioTransaction in project portfolio by buchen.
the class OnvistaPDFExtractorTest method testKapitalerhoehung.
@Test
public void testKapitalerhoehung() throws IOException {
OnvistaPDFExtractor extractor = new OnvistaPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "OnvistaKapitalerhoehung.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
assertSecurityKapitalherhöhung(results);
// check delivery transaction
Optional<Item> item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(PortfolioTransaction.class));
PortfolioTransaction entry = (PortfolioTransaction) item.get().getSubject();
assertThat(entry.getType(), is(PortfolioTransaction.Type.DELIVERY_INBOUND));
assertThat(entry.getDateTime(), is(is(LocalDateTime.parse("2011-04-06T00:00"))));
assertThat(entry.getShares(), is(Values.Share.factorize(25)));
}
use of name.abuchen.portfolio.model.PortfolioTransaction in project portfolio by buchen.
the class OnvistaPDFExtractorTest method testAusbuchungDividendenRechte.
@Test
public void testAusbuchungDividendenRechte() throws IOException {
OnvistaPDFExtractor extractor = new OnvistaPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "OnvistaAusbuchungDividendenRechte.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
assertSecurityEinAusbuchungDividendenRechte(results);
// check delivery transaction
Optional<Item> item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(PortfolioTransaction.class));
PortfolioTransaction entry = (PortfolioTransaction) item.get().getSubject();
assertThat(entry.getType(), is(PortfolioTransaction.Type.DELIVERY_OUTBOUND));
assertThat(entry.getDateTime(), is(is(LocalDateTime.parse("2016-06-21T00:00"))));
assertThat(entry.getShares(), is(Values.Share.factorize(25)));
}
use of name.abuchen.portfolio.model.PortfolioTransaction in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testWertpapierKauf8.
@Test
public void testWertpapierKauf8() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexKauf8.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
List<PortfolioTransaction> tx = //
results.stream().filter(i -> i instanceof BuySellEntryItem).map(i -> ((BuySellEntry) i.getSubject()).getPortfolioTransaction()).collect(Collectors.toList());
assertThat(tx.size(), is(1));
assertThat(tx, hasItem(allOf(//
hasProperty("dateTime", is(LocalDateTime.parse("2018-01-09T00:00"))), //
hasProperty("type", is(PortfolioTransaction.Type.BUY)), hasProperty("monetaryAmount", is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(6.16)))))));
}
use of name.abuchen.portfolio.model.PortfolioTransaction in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testWertpapierKauf3.
@Test
public void testWertpapierKauf3() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexKauf3.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
Optional<Item> item;
// security
item = results.stream().filter(i -> i instanceof SecurityItem).findFirst();
assertThat(item.isPresent(), is(true));
Security security = ((SecurityItem) item.get()).getSecurity();
assertThat(security.getIsin(), is("IE00B2QWCY14"));
assertThat(security.getWkn(), is("A0Q1YY"));
assertThat(security.getName(), is("ISHSIII-S+P SM.CAP600 DLD"));
PortfolioTransaction transaction = results.stream().filter(i -> i instanceof Extractor.BuySellEntryItem).map(i -> (BuySellEntry) ((Extractor.BuySellEntryItem) i).getSubject()).map(b -> b.getPortfolioTransaction()).findAny().get();
assertThat(transaction.getType(), is(PortfolioTransaction.Type.BUY));
assertThat(transaction.getAmount(), is(Values.Amount.factorize(1050)));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2016-12-15T00:00")));
assertThat(transaction.getUnitSum(Unit.Type.FEE), is(Money.of("EUR", Values.Amount.factorize(0))));
assertThat(transaction.getShares(), is(Values.Share.factorize(19.334524)));
}
Aggregations