File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
main/java/org/javamoney/moneta/format/internal
test/java/org/javamoney/moneta/format Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -86,8 +86,6 @@ public String getNumberPattern() {
8686 public void print (Appendable appendable , MonetaryAmount amount )
8787 throws IOException {
8888 int digits = amount .getCurrency ().getDefaultFractionDigits ();
89- this .formatFormat .setMinimumFractionDigits (digits );
90- this .formatFormat .setMaximumFractionDigits (digits );
9189 if (amountFormatContext .get ("groupingSizes" , int [].class ) == null ||
9290 amountFormatContext .get ("groupingSizes" , int [].class ).length == 0 ) {
9391 appendable .append (this .formatFormat .format (amount .getNumber ()
Original file line number Diff line number Diff line change 2727import javax .money .format .MonetaryAmountFormat ;
2828import javax .money .format .MonetaryFormats ;
2929
30+ import org .javamoney .moneta .Money ;
3031import org .testng .annotations .Test ;
3132
3233/**
@@ -148,4 +149,26 @@ public void testParse() throws ParseException {
148149 .create (), defaultFormat .parse ("12,50 CHF" ));
149150 }
150151
152+
153+ /**
154+ * Test related to {@link https://java.net/jira/browse/JAVAMONEY-92}.
155+ */
156+ @ Test
157+ public void testWithCustomPattern () {
158+ MonetaryAmountFormat format = MonetaryFormats .getAmountFormat (
159+ AmountFormatQueryBuilder .of (Locale .GERMANY )
160+ .set (CurrencyStyle .SYMBOL )
161+ .set ("pattern" , "#,##0.00### ¤" )
162+ .build ());
163+ Money money = Money .of (12345.23456789 , "EUR" );
164+ assertEquals ("12.345,23457 €" , format .format (money ));
165+
166+ format = MonetaryFormats .getAmountFormat (
167+ AmountFormatQueryBuilder .of (Locale .GERMANY )
168+ .set (CurrencyStyle .SYMBOL )
169+ .build ());
170+ assertEquals ("12.345,23 €" , format .format (money ));
171+
172+
173+ }
151174}
You can’t perform that action at this time.
0 commit comments