-
Notifications
You must be signed in to change notification settings - Fork 625
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore fixing of gross value unit if there is no suitable
Issue: https://forum.portfolio-performance.info/t/fehler-ungueltige-buchungskomponente-gross-value/1396/25
- Loading branch information
Showing
3 changed files
with
84 additions
and
15 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
name.abuchen.portfolio.tests/src/name/abuchen/portfolio/model/TransactionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package name.abuchen.portfolio.model; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
import java.math.BigDecimal; | ||
|
||
import org.junit.Test; | ||
|
||
import name.abuchen.portfolio.model.Transaction.Unit; | ||
import name.abuchen.portfolio.money.CurrencyUnit; | ||
import name.abuchen.portfolio.money.Money; | ||
import name.abuchen.portfolio.money.Values; | ||
|
||
public class TransactionTest | ||
{ | ||
|
||
@Test | ||
public void testUnitValidityCheckWithSmallValues() | ||
{ | ||
Transaction.Unit unit = new Transaction.Unit(Unit.Type.TAX, | ||
Money.of(CurrencyUnit.EUR, Values.Amount.factorize(4.33)), | ||
Money.of("JPY", Values.Amount.factorize(0.03)), //$NON-NLS-1$ | ||
BigDecimal.valueOf(131.53)); | ||
|
||
assertThat(unit.getAmount().getAmount(), is(Values.Amount.factorize(4.33))); | ||
} | ||
|
||
@Test(expected = IllegalArgumentException.class) | ||
public void testUnitRoundingCheck() | ||
{ | ||
new Transaction.Unit(Unit.Type.TAX, | ||
Money.of(CurrencyUnit.EUR, Values.Amount.factorize(4.33)), | ||
Money.of("JPY", Values.Amount.factorize(0.01)), //$NON-NLS-1$ | ||
BigDecimal.valueOf(131.53)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters