use of name.abuchen.portfolio.model.Account in project portfolio by buchen.
the class CheckCurrenciesAccountTransactionTest method testTransactionCurrencyMatchesAccount.
@Test
public void testTransactionCurrencyMatchesAccount() {
Account account = new Account();
account.setCurrencyCode("EUR");
AccountTransaction t = new AccountTransaction();
t.setMonetaryAmount(Money.of("EUR", 1_00));
assertThat(action.process(t, account).getCode(), is(Status.Code.OK));
t.setMonetaryAmount(Money.of("USD", 1_00));
assertThat(action.process(t, account).getCode(), is(Status.Code.ERROR));
}
use of name.abuchen.portfolio.model.Account in project portfolio by buchen.
the class CheckCurrenciesAccountTransactionTest method testTransactionIfSecurityIsIndex.
@Test
public void testTransactionIfSecurityIsIndex() {
Account account = new Account();
account.setCurrencyCode("EUR");
Security security = new Security("", null);
AccountTransaction t = new AccountTransaction();
t.setMonetaryAmount(Money.of("EUR", 1_00));
t.setSecurity(security);
assertThat(action.process(t, account).getCode(), is(Status.Code.ERROR));
}
use of name.abuchen.portfolio.model.Account in project portfolio by buchen.
the class CheckCurrenciesAccountTransactionTest method testTransactionCurrencyMatchesSecurity.
@Test
public void testTransactionCurrencyMatchesSecurity() {
Account account = new Account();
account.setCurrencyCode("EUR");
Security security = new Security("", "EUR");
AccountTransaction t = new AccountTransaction();
t.setMonetaryAmount(Money.of("EUR", 1_00));
t.setSecurity(security);
assertThat(action.process(t, account).getCode(), is(Status.Code.OK));
security.setCurrencyCode("USD");
assertThat(action.process(t, account).getCode(), is(Status.Code.ERROR));
}
use of name.abuchen.portfolio.model.Account in project portfolio by buchen.
the class CheckCurrenciesBuySellEntryTest method testBuySellEntry.
@Test
public void testBuySellEntry() {
Account account = new Account();
account.setCurrencyCode("EUR");
Security security = new Security();
security.setCurrencyCode("USD");
Portfolio portfolio = new Portfolio();
BuySellEntry entry = new BuySellEntry();
entry.setType(PortfolioTransaction.Type.BUY);
entry.setSecurity(security);
entry.setMonetaryAmount(Money.of("EUR", 100_00));
entry.getPortfolioTransaction().addUnit(new Unit(Unit.Type.GROSS_VALUE, Money.of("EUR", 80_00), Money.of("USD", 100_00), BigDecimal.valueOf(0.8)));
assertThat(action.process(entry, account, portfolio).getCode(), is(Status.Code.OK));
}
use of name.abuchen.portfolio.model.Account in project portfolio by buchen.
the class CheckValidTypesActionTest method testAccountTransaction.
@Test
public void testAccountTransaction() {
Account account = new Account();
account.setCurrencyCode("EUR");
AccountTransaction t = new AccountTransaction();
t.setMonetaryAmount(Money.of("EUR", 1_00));
t.setType(AccountTransaction.Type.BUY);
assertThat(action.process(t, account).getCode(), is(Status.Code.ERROR));
t.setType(AccountTransaction.Type.SELL);
assertThat(action.process(t, account).getCode(), is(Status.Code.ERROR));
t.setType(AccountTransaction.Type.TRANSFER_IN);
assertThat(action.process(t, account).getCode(), is(Status.Code.ERROR));
t.setType(AccountTransaction.Type.TRANSFER_OUT);
assertThat(action.process(t, account).getCode(), is(Status.Code.ERROR));
t.setType(AccountTransaction.Type.DEPOSIT);
assertThat(action.process(t, account).getCode(), is(Status.Code.OK));
t.setType(AccountTransaction.Type.DIVIDENDS);
assertThat(action.process(t, account).getCode(), is(Status.Code.OK));
t.setType(AccountTransaction.Type.FEES);
assertThat(action.process(t, account).getCode(), is(Status.Code.OK));
t.setType(AccountTransaction.Type.FEES_REFUND);
assertThat(action.process(t, account).getCode(), is(Status.Code.OK));
t.setType(AccountTransaction.Type.INTEREST);
assertThat(action.process(t, account).getCode(), is(Status.Code.OK));
t.setType(AccountTransaction.Type.INTEREST_CHARGE);
assertThat(action.process(t, account).getCode(), is(Status.Code.OK));
t.setType(AccountTransaction.Type.REMOVAL);
assertThat(action.process(t, account).getCode(), is(Status.Code.OK));
t.setType(AccountTransaction.Type.TAX_REFUND);
assertThat(action.process(t, account).getCode(), is(Status.Code.OK));
t.setType(AccountTransaction.Type.TAXES);
assertThat(action.process(t, account).getCode(), is(Status.Code.OK));
}
Aggregations