OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
6 | 6 |
7 import android.support.test.filters.MediumTest; | 7 import android.support.test.filters.MediumTest; |
8 | 8 |
9 import junit.framework.Assert; | 9 import junit.framework.Assert; |
10 | 10 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 for (int i = 0; i < testCases.size(); i++) { | 91 for (int i = 0; i < testCases.size(); i++) { |
92 Object[] testCase = testCases.get(i); | 92 Object[] testCase = testCases.get(i); |
93 | 93 |
94 String amount = (String) testCase[0]; | 94 String amount = (String) testCase[0]; |
95 String currency = (String) testCase[1]; | 95 String currency = (String) testCase[1]; |
96 String locale = (String) testCase[2]; | 96 String locale = (String) testCase[2]; |
97 String expectedCurrencyFormatting = (String) testCase[3]; | 97 String expectedCurrencyFormatting = (String) testCase[3]; |
98 String expectedAmountFormatting = (String) testCase[4]; | 98 String expectedAmountFormatting = (String) testCase[4]; |
99 | 99 |
100 CurrencyFormatter formatter = | 100 CurrencyFormatter formatter = |
101 new CurrencyFormatter(currency, null, LocaleUtils.forLanguag
eTag(locale)); | 101 new CurrencyFormatter(currency, "", LocaleUtils.forLanguageT
ag(locale)); |
102 | 102 |
103 String formattedAmount = formatter.format(amount).replace(SPACE, " "
); | 103 String formattedAmount = formatter.format(amount).replace(SPACE, " "
); |
104 Assert.assertEquals("\"" + currency + "\" \"" + amount + "\" (\"" +
locale | 104 Assert.assertEquals("\"" + currency + "\" \"" + amount + "\" (\"" +
locale |
105 + "\" locale) should be formatted into \"" + expecte
dAmountFormatting | 105 + "\" locale) should be formatted into \"" + expecte
dAmountFormatting |
106 + "\"", | 106 + "\"", |
107 expectedAmountFormatting, formattedAmount); | 107 expectedAmountFormatting, formattedAmount); |
108 Assert.assertEquals("\"" + currency + "\"" | 108 Assert.assertEquals("\"" + currency + "\"" |
109 + " should be formatted into \"" + expectedCurrencyF
ormatting + "\"", | 109 + " should be formatted into \"" + expectedCurrencyF
ormatting + "\"", |
110 expectedCurrencyFormatting, formatter.getFormattedCurrencyCo
de()); | 110 expectedCurrencyFormatting, formatter.getFormattedCurrencyCo
de()); |
111 } | 111 } |
112 } | 112 } |
113 } | 113 } |
OLD | NEW |