use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class OnvistaPDFExtractorTest method testKontoauszugMehrereBuchungen2017.
@Test
public void testKontoauszugMehrereBuchungen2017() throws IOException {
OnvistaPDFExtractor extractor = new OnvistaPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "OnvistaKontoauszugMehrereBuchungen2017.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(7));
new AssertImportActions().check(results, CurrencyUnit.EUR);
assertTransaction(results, 0, "2017-04-04T00:00", AccountTransaction.Type.DEPOSIT, CurrencyUnit.EUR, 200.00);
assertTransaction(results, 1, "2017-04-10T00:00", AccountTransaction.Type.REMOVAL, CurrencyUnit.EUR, 0.89);
assertTransaction(results, 2, "2017-05-03T00:00", AccountTransaction.Type.DEPOSIT, CurrencyUnit.EUR, 200.00);
assertTransaction(results, 3, "2017-06-01T00:00", AccountTransaction.Type.DEPOSIT, CurrencyUnit.EUR, 100.00);
assertTransaction(results, 4, "2017-06-02T00:00", AccountTransaction.Type.DEPOSIT, CurrencyUnit.EUR, 200.00);
assertTransaction(results, 5, "2017-06-26T00:00", AccountTransaction.Type.DEPOSIT, CurrencyUnit.EUR, 300.00);
assertTransaction(results, 6, "2017-06-26T00:00", AccountTransaction.Type.DEPOSIT, CurrencyUnit.EUR, 200.00);
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class CommerzbankPDFExtractorTest method testWertpapierkauf.
@Test
public void testWertpapierkauf() throws IOException {
CommerzbankPDFExtractor extractor = new CommerzbankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "CommerzbankWertpapierkauf.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// check security
Security security = results.stream().filter(i -> i instanceof SecurityItem).findAny().get().getSecurity();
assertThat(security.getName(), is("i S h s I I I - C o r e MSCI W o r l d U . E T F"));
assertThat(security.getWkn(), is("A0RPWH"));
assertThat(security.getCurrencyCode(), is(CurrencyUnit.EUR));
// check 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(24.96))));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2017-04-18T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(0.572)));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class ConsorsbankPDFExtractorTest method testErtragsgutschrift.
@Test
public void testErtragsgutschrift() throws IOException {
ConsorsbankPDFExtractor extractor = new ConsorsbankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "ConsorsbankErtragsgutschrift.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// check security
Security security = assertSecurity(results, false);
// check transaction
Optional<Item> item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
assertDividendTransaction(security, item);
// check tax
AccountTransaction t = (AccountTransaction) item.get().getSubject();
assertThat(t.getUnitSum(Type.TAX), is(Money.of("EUR", 111_00L + 6_10L)));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class ConsorsbankPDFExtractorTest method testErtragsgutschrift2.
@Test
public void testErtragsgutschrift2() throws IOException {
ConsorsbankPDFExtractor extractor = new ConsorsbankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "ConsorsbankErtragsgutschrift2.txt"), errors);
assertThat(errors, empty());
// since taxes are zero, no tax transaction must be created
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
Optional<Item> item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(1444))));
}
use of name.abuchen.portfolio.datatransfer.actions.AssertImportActions in project portfolio by buchen.
the class ConsorsbankPDFExtractorTest method testWertpapierKaufIfSecurityIsPresent.
@Test
public void testWertpapierKaufIfSecurityIsPresent() throws IOException {
Client client = new Client();
Security s = new Security();
s.setName("COMS.-MSCI WORL.T.U.ETF I");
s.setWkn("ETF110");
client.addSecurity(s);
ConsorsbankPDFExtractor extractor = new ConsorsbankPDFExtractor(client);
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "ConsorsbankKauf1.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(1));
new AssertImportActions().check(results, CurrencyUnit.EUR);
// check buy sell transaction
Item item = results.get(0);
BuySellEntry entry = (BuySellEntry) item.getSubject();
assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, 5000_00L)));
}
Aggregations