use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class DABPDFExtractorTest method testWertpapierKauf5.
@Test
public void testWertpapierKauf5() throws IOException {
DABPDFExtractor extractor = new DABPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DABKauf5.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// check security
Security security = getSecurity(results);
assertThat(security.getIsin(), is("IE00B3F81R35"));
assertThat(security.getName(), is("iShsIII-Core EO Corp.Bd U.ETF Registered Shares o.N."));
assertThat(security.getCurrencyCode(), is(CurrencyUnit.EUR));
// check buy sell transaction
Optional<Item> item = results.stream().filter(i -> i instanceof BuySellEntryItem).findFirst();
BuySellEntry entry = (BuySellEntry) item.get().getSubject();
assertThat(entry.getPortfolioTransaction().getType(), is(PortfolioTransaction.Type.BUY));
assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(6.46))));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2017-03-01T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(0.0499)));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of(CurrencyUnit.EUR, 0L)));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class DABPDFExtractorTest method testWertpapierKauf3.
@Test
public void testWertpapierKauf3() throws IOException {
DABPDFExtractor extractor = new DABPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DABKauf3.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// check security
Security security = getSecurity(results);
assertThat(security.getIsin(), is("LU0635178014"));
assertThat(security.getName(), is("ComSta.-MSCI Em.Mkts.TRN U.ETF Inhaber-Anteile I o.N."));
assertThat(security.getCurrencyCode(), is(CurrencyUnit.EUR));
// check buy sell transaction
Optional<Item> item = results.stream().filter(i -> i instanceof BuySellEntryItem).findFirst();
BuySellEntry entry = (BuySellEntry) item.get().getSubject();
assertThat(entry.getPortfolioTransaction().getType(), is(PortfolioTransaction.Type.BUY));
assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, 325_00)));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2016-01-04T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(10.9468)));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of(CurrencyUnit.EUR, 0L)));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class DeutscheBankPDFExtractorTest method testWertpapierVerkauf.
@Test
public void testWertpapierVerkauf() throws IOException {
DeutscheBankPDFExtractor extractor = new DeutscheBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DeutscheBankVerkauf.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
assertSecurity(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.SELL));
assertThat(entry.getAccountTransaction().getType(), is(AccountTransaction.Type.SELL));
assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(2074.71))));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2015-04-08T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(61)));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.TAX), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(122.94 + 6.76 + 1.23))));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(7.90 + 0.60 + 2))));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class DeutscheBankPDFExtractorTest method testErtragsgutschriftWhenSecurityExists.
@Test
public void testErtragsgutschriftWhenSecurityExists() throws IOException {
Client client = new Client();
Security security = new Security("BASF", "DE000BASF111", null, null);
client.addSecurity(security);
DeutscheBankPDFExtractor extractor = new DeutscheBankPDFExtractor(client);
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DeutscheBankErtragsgutschrift.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(1));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// check transaction
AccountTransaction transaction = (AccountTransaction) results.get(0).getSubject();
assertThat(transaction.getType(), is(AccountTransaction.Type.DIVIDENDS));
assertThat(transaction.getSecurity(), is(security));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class DeutscheBankPDFExtractorTest method testWertpapierKauf2.
@Test
public void testWertpapierKauf2() throws IOException {
DeutscheBankPDFExtractor extractor = new DeutscheBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DeutscheBankKauf2.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
assertSecurity(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().getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(3524.98))));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2015-04-08T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(36)));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of(CurrencyUnit.EUR, 11_38L)));
}
Aggregations