use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testWertpapierVerkauf3.
@Test
public void testWertpapierVerkauf3() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexVerkauf3.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("DE0009807008"));
assertThat(security.getWkn(), is("980700"));
assertThat(security.getName(), is("GRUNDBESITZ EUROPA RC"));
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.SELL));
assertThat(entry.getAccountTransaction().getType(), is(AccountTransaction.Type.SELL));
assertThat(entry.getPortfolioTransaction().getAmount(), is(Values.Amount.factorize(4840.15)));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2017-07-04T00: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(121)));
}
use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testWertpapierVerkaufSteuererstattung.
@Test
public void testWertpapierVerkaufSteuererstattung() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexVerkaufSteuererstattung.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(3));
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("DE000SKWM021"));
assertThat(security.getWkn(), is("SKWM02"));
assertThat(security.getName(), is("SKW STAHL-METAL.HLDG.NA"));
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.SELL));
assertThat(entry.getAccountTransaction().getType(), is(AccountTransaction.Type.SELL));
assertThat(entry.getPortfolioTransaction().getAmount(), is(Values.Amount.factorize(1253.15)));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2016-09-08T00:00")));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of("EUR", Values.Amount.factorize(11.85))));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(460)));
// check Steuererstattung
Item itemTaxReturn = results.stream().filter(i -> i instanceof TransactionItem).collect(Collectors.toList()).get(0);
// Optional<Item> itemTaxReturn = results.stream().filter(i -> i
// instanceof TransactionItem).findFirst();
AccountTransaction entryTaxReturn = (AccountTransaction) itemTaxReturn.getSubject();
assertThat(entryTaxReturn.getType(), is(AccountTransaction.Type.TAX_REFUND));
assertThat(entryTaxReturn.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(463.04))));
assertThat(entryTaxReturn.getDateTime(), is(LocalDateTime.parse("2016-09-08T00:00")));
}
use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testWertpapierBestandsausbuchungNeuesFormat.
@Test
public void testWertpapierBestandsausbuchungNeuesFormat() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexBestandsausbuchung2.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("DE000SG0WRD3"));
assertThat(security.getWkn(), is("SG0WRD"));
assertThat(security.getName(), is("SG EFF. TURBOL ZS"));
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.SELL));
assertThat(entry.getAccountTransaction().getType(), is(AccountTransaction.Type.SELL));
assertThat(entry.getPortfolioTransaction().getAmount(), is(Values.Amount.factorize(111.22)));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2015-09-28T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(83)));
}
use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testWertpapierVerkauf4.
@Test
public void testWertpapierVerkauf4() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexVerkauf4.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.SELL)), hasProperty("monetaryAmount", is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(0.95)))))));
}
use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testWertpapierKauf10.
@Test
public void testWertpapierKauf10() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexKauf10.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("LU0274211480"));
assertThat(security.getWkn(), is("DBX1DA"));
assertThat(security.getName(), is("DB X-TRACK.DAX ETF(DR)1C"));
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(1000.00)));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2018-01-02T00:00")));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of("EUR", Values.Amount.factorize(0))));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(7.979324)));
}
Aggregations