use of name.abuchen.portfolio.datatransfer.Extractor in project portfolio by buchen.
the class OnvistaPDFExtractorTest method testZwangsabfindung.
@Test
public void testZwangsabfindung() throws IOException {
OnvistaPDFExtractor extractor = new OnvistaPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "OnvistaZwangsabfindung.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
assertSecurityZwangsabfindung(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.SELL));
assertThat(entry.getPortfolioTransaction().getCurrencyCode(), is(CurrencyUnit.EUR));
assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(167.00))));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(is(LocalDateTime.parse("2015-09-22T00:00"))));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(25)));
}
use of name.abuchen.portfolio.datatransfer.Extractor in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testErtragsgutschrift.
@Test
public void testErtragsgutschrift() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexErtragsgutschrift.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// 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("DE0008402215"));
assertThat(security.getWkn(), is("840221"));
assertThat(security.getName(), is("HANN.RUECK SE NA O.N."));
assertThat(security.getCurrencyCode(), is(CurrencyUnit.EUR));
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.getDateTime(), is(LocalDateTime.parse("2014-05-08T00:00")));
assertThat(transaction.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, 795_15L)));
assertThat(transaction.getShares(), is(Values.Share.factorize(360)));
}
use of name.abuchen.portfolio.datatransfer.Extractor 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 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)))))));
}
use of name.abuchen.portfolio.datatransfer.Extractor in project portfolio by buchen.
the class FinTechGroupBankPDFExtractorTest method testErtragsgutschrift2.
@Test
public void testErtragsgutschrift2() throws IOException {
FinTechGroupBankPDFExtractor extractor = new FinTechGroupBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "FlatexErtragsgutschrift2.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("DE1234567890"));
assertThat(security.getWkn(), is("AB1234"));
assertThat(security.getName(), is("ISH.FOOBAR 12345666 x.EFT"));
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.getDateTime(), is(LocalDateTime.parse("2014-01-15T00:00")));
assertThat(transaction.getAmount(), is(Values.Amount.factorize(55.55)));
assertThat(transaction.getShares(), is(Values.Share.factorize(99)));
}
Aggregations