-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
False price formatting
- Loading branch information
Showing
2 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
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
28 changes: 28 additions & 0 deletions
28
piwik-sdk/src/test/java/org/piwik/sdk/tools/CurrencyFormatterTest.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,28 @@ | ||
package org.piwik.sdk.tools; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.piwik.sdk.testhelper.FullEnvTestRunner; | ||
import org.robolectric.annotation.Config; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
@Config(emulateSdk = 18, manifest = Config.NONE) | ||
@RunWith(FullEnvTestRunner.class) | ||
public class CurrencyFormatterTest { | ||
|
||
@Test | ||
public void testCurrencyFormat() throws Exception { | ||
String currency = CurrencyFormatter.priceString(1000); | ||
assertEquals("10.00", currency); | ||
|
||
currency = CurrencyFormatter.priceString(3950); | ||
assertEquals("39.50", currency); | ||
|
||
currency = CurrencyFormatter.priceString(1); | ||
assertEquals("0.01", currency); | ||
|
||
currency = CurrencyFormatter.priceString(25034); | ||
assertEquals("250.34", currency); | ||
} | ||
} |