|
17 | 17 |
|
18 | 18 | import static org.testng.Assert.assertEquals; |
19 | 19 |
|
| 20 | +import java.math.BigDecimal; |
20 | 21 | import java.util.Locale; |
21 | 22 |
|
22 | 23 | import javax.money.MonetaryAmount; |
23 | 24 | import javax.money.format.AmountFormatQueryBuilder; |
24 | 25 | import javax.money.format.MonetaryAmountFormat; |
25 | 26 | import javax.money.format.MonetaryFormats; |
26 | 27 |
|
| 28 | +import org.javamoney.moneta.Money; |
27 | 29 | import org.testng.annotations.Test; |
28 | 30 |
|
29 | 31 | public class MonetaryFormatsTest { |
@@ -53,4 +55,20 @@ public void testParseFR() { |
53 | 55 | assertEquals(amountOk.getNumber().doubleValueExact(), 123.01); // OK |
54 | 56 | assertEquals(amountKo.getNumber().doubleValueExact(), 14000.12); // KO |
55 | 57 | } |
| 58 | + |
| 59 | + /** |
| 60 | + * Test related to parsing and formatting for India. |
| 61 | + * https://github.com/JavaMoney/jsr354-ri/issues/275 |
| 62 | + */ |
| 63 | + @Test(enabled=false) |
| 64 | + public void testRupeeFormatting() { |
| 65 | + BigDecimal amount = new BigDecimal("67890000000000"); |
| 66 | + Locale india = new Locale("en, IN"); |
| 67 | + |
| 68 | + MonetaryAmountFormat format = MonetaryFormats.getAmountFormat(india); |
| 69 | + Money money = Money.of(amount, "INR"); |
| 70 | + String expectedFormattedString = "INR 6,78,90,00,00,00,000.00"; |
| 71 | + assertEquals(format.format(money), expectedFormattedString); |
| 72 | + assertEquals(money, Money.parse(expectedFormattedString, format)); |
| 73 | + } |
56 | 74 | } |
0 commit comments