mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-17 20:11:21 +02:00
More testing
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1501 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
@@ -83,6 +83,7 @@ public class EconomyTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
//test Format
|
//test Format
|
||||||
|
assertEquals("$1000", Economy.format(1000.0));
|
||||||
assertEquals("$10", Economy.format(10.0));
|
assertEquals("$10", Economy.format(10.0));
|
||||||
assertEquals("$10.10", Economy.format(10.10));
|
assertEquals("$10.10", Economy.format(10.10));
|
||||||
assertEquals("$10.10", Economy.format(10.102));
|
assertEquals("$10.10", Economy.format(10.102));
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
@@ -8,12 +10,28 @@ import junit.framework.TestCase;
|
|||||||
public class UtilTest extends TestCase
|
public class UtilTest extends TestCase
|
||||||
{
|
{
|
||||||
public void testFDDnow() {
|
public void testFDDnow() {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Util.updateLocale("en_US", File.createTempFile("test1", "").getParentFile());
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
fail(ex.getMessage());
|
||||||
|
}
|
||||||
Calendar c = new GregorianCalendar();
|
Calendar c = new GregorianCalendar();
|
||||||
String resp = Util.formatDateDiff(c, c);
|
String resp = Util.formatDateDiff(c, c);
|
||||||
assertEquals(resp, "now");
|
assertEquals(resp, "now");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFDDfuture() {
|
public void testFDDfuture() {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Util.updateLocale("en_US", File.createTempFile("test2", "").getParentFile());
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
fail(ex.getMessage());
|
||||||
|
}
|
||||||
Calendar a, b;
|
Calendar a, b;
|
||||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||||
b = new GregorianCalendar(2010, 1, 1, 10, 0, 1);
|
b = new GregorianCalendar(2010, 1, 1, 10, 0, 1);
|
||||||
@@ -78,6 +96,14 @@ public class UtilTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testFDDpast() {
|
public void testFDDpast() {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Util.updateLocale("en_US", File.createTempFile("test3", "").getParentFile());
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
fail(ex.getMessage());
|
||||||
|
}
|
||||||
Calendar a, b;
|
Calendar a, b;
|
||||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||||
b = new GregorianCalendar(2010, 1, 1, 9, 59, 59);
|
b = new GregorianCalendar(2010, 1, 1, 9, 59, 59);
|
||||||
|
Reference in New Issue
Block a user