use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class DkbPDFExtractorTest method testWertpapierKauf.
@Test
public void testWertpapierKauf() throws IOException {
DkbPDFExtractor extractor = new DkbPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DkbKauf.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
// check security
assertSecurityBuy(results);
// check buy sell transaction
Optional<Item> item = results.stream().filter(i -> i instanceof BuySellEntryItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(BuySellEntry.class));
BuySellEntry entry = (BuySellEntry) item.get().getSubject();
assertThat(entry.getPortfolioTransaction().getType(), is(PortfolioTransaction.Type.BUY));
assertThat(entry.getAccountTransaction().getType(), is(AccountTransaction.Type.BUY));
assertThat(entry.getPortfolioTransaction().getCurrencyCode(), is(CurrencyUnit.EUR));
assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(2030.66))));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2015-11-25T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(20)));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.TAX), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(/* 80.66 */
0.00))));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(7.50))));
}
use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class DkbPDFExtractorTest method testWertpapierRueckzahlung.
@Test
public void testWertpapierRueckzahlung() throws IOException {
DkbPDFExtractor extractor = new DkbPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DkbRueckzahlung.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
assertSecurityRueckzahlung(results);
// check buy sell transaction
Optional<Item> item = results.stream().filter(i -> i instanceof BuySellEntryItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(BuySellEntry.class));
BuySellEntry entry = (BuySellEntry) item.get().getSubject();
assertThat(entry.getPortfolioTransaction().getType(), is(PortfolioTransaction.Type.DELIVERY_OUTBOUND));
assertThat(entry.getAccountTransaction().getType(), is(AccountTransaction.Type.TRANSFER_IN));
assertThat(entry.getPortfolioTransaction().getCurrencyCode(), is(CurrencyUnit.EUR));
assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(2974.39))));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2014-07-31T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(30)));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.TAX), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(25.61))));
}
use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testWertpapierBestandsausbuchung.
@Test
public void testWertpapierBestandsausbuchung() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexBestandsausbuchung.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(6));
new AssertImportActions().check(results, CurrencyUnit.EUR);
assertFirstSecurityBestandsausbuchung(results.stream().filter(i -> i instanceof SecurityItem).findFirst());
assertFirstTransactionBestandsausbuchung(results.stream().filter(i -> i instanceof BuySellEntryItem).findFirst());
assertSecondSecurityBestandsausbuchung(//
results.stream().filter(i -> i instanceof SecurityItem).collect(Collectors.toList()).get(1));
assertSecondTransactionBestandsausbuchung(results.stream().filter(i -> i instanceof BuySellEntryItem).collect(Collectors.toList()).get(1));
assertThirdSecurityBestandsausbuchung(//
results.stream().filter(i -> i instanceof SecurityItem).collect(Collectors.toList()).get(2));
assertThirdTransactionBestandsausbuchung(results.stream().filter(i -> i instanceof BuySellEntryItem).collect(Collectors.toList()).get(2));
}
use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testWertpapierKauf2.
@Test
public void testWertpapierKauf2() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexKauf2.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("LU0392495023"));
assertThat(security.getWkn(), is("ETF114"));
assertThat(security.getName(), is("C.S.-MSCI PACIF.T.U.ETF I"));
item = results.stream().filter(i -> i instanceof BuySellEntryItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(BuySellEntry.class));
BuySellEntry entry = (BuySellEntry) item.get().getSubject();
assertThat(entry.getPortfolioTransaction().getType(), is(PortfolioTransaction.Type.BUY));
assertThat(entry.getAccountTransaction().getType(), is(AccountTransaction.Type.BUY));
assertThat(entry.getPortfolioTransaction().getAmount(), is(Values.Amount.factorize(50.30)));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2015-12-03T00:00")));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of("EUR", Values.Amount.factorize(5.90))));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(10)));
}
use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testWertpapierKauf7.
@Test
public void testWertpapierKauf7() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexKauf7.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(20));
List<PortfolioTransaction> tx = //
results.stream().filter(i -> i instanceof BuySellEntryItem).map(i -> ((BuySellEntry) i.getSubject()).getPortfolioTransaction()).collect(Collectors.toList());
assertThat(tx.size(), is(10));
assertThat(tx, hasItem(allOf(//
hasProperty("dateTime", is(LocalDateTime.parse("2017-11-01T00:00"))), //
hasProperty("type", is(PortfolioTransaction.Type.BUY)), hasProperty("monetaryAmount", is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(3008.9)))))));
}
Aggregations