This repository has been archived by the owner on Feb 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JAFFA-718. Fixed the decimal parse issue for Norwegian Bokmal and other European… See merge request jaffa/jaffa-framework!266
- Loading branch information
Showing
2 changed files
with
60 additions
and
2 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
51 changes: 51 additions & 0 deletions
51
jaffa-core/src/test/java/org/jaffa/datatypes/ParserTest.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,51 @@ | ||
package org.jaffa.datatypes; | ||
|
||
|
||
import org.jaffa.datatypes.exceptions.FormatDecimalException; | ||
import org.jaffa.presentation.portlet.session.LocaleContext; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import java.util.Locale; | ||
|
||
public class ParserTest { | ||
|
||
//Test Locale English parse | ||
@Test | ||
public void test_ParseDecimal_EN() { | ||
Double aDouble = null; | ||
try { | ||
LocaleContext.setLocale(new Locale("en", "US")); | ||
aDouble = Parser.parseDecimal("1000.0", null); | ||
Assert.assertEquals(1000.0, aDouble.doubleValue(), 0.00); | ||
} catch (FormatDecimalException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
//Test Locale Norwegian Bokmal parse | ||
@Test | ||
public void test_ParseDecimal_NB() { | ||
Double aDouble = null; | ||
try { | ||
LocaleContext.setLocale(new Locale("nb", "NO")); | ||
aDouble = Parser.parseDecimal("100000.0", null); | ||
Assert.assertEquals(100000.0, aDouble.doubleValue(), 0.00); | ||
} catch (FormatDecimalException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
//Test Locale Arabic parse | ||
@Test | ||
public void test_ParseDecimal_AR() { | ||
Double aDouble = null; | ||
try { | ||
LocaleContext.setLocale(new Locale("ar", "OM")); | ||
aDouble = Parser.parseDecimal("1000.0", null); | ||
Assert.assertEquals(1000.0, aDouble.doubleValue(), 0.00); | ||
} catch (FormatDecimalException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
} |