aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2019-10-26 05:26:52 +0000
committerDominik Stadler <centic@apache.org>2019-10-26 05:26:52 +0000
commit14812bee45f28ae07d32da4873ee434a7210224e (patch)
treedbdde48bf2867fa7083eba35a2799aed919c3981 /src/testcases
parent04e85aa22d57e76c8d50c89db5fa7dedcb14b092 (diff)
downloadpoi-14812bee45f28ae07d32da4873ee434a7210224e.tar.gz
poi-14812bee45f28ae07d32da4873ee434a7210224e.zip
Adjust comments and add slightly more test-coverage
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1868982 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/TestFractionFormat.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/TestFractionFormat.java b/src/testcases/org/apache/poi/ss/usermodel/TestFractionFormat.java
index dd08f6d799..95e2947007 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/TestFractionFormat.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/TestFractionFormat.java
@@ -27,6 +27,7 @@ import java.io.InputStreamReader;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
import org.apache.poi.util.LocaleUtil;
+import org.junit.Ignore;
import org.junit.Test;
/**
@@ -35,15 +36,34 @@ import org.junit.Test;
*/
public final class TestFractionFormat {
@Test
- public void testSingle() throws Exception {
+ public void testSingle() {
FractionFormat f = new FractionFormat("", "##");
double val = 321.321;
String ret = f.format(val);
assertEquals("26027/81", ret);
}
-
+
+ @Test(expected = IllegalStateException.class)
+ public void testInvalid() {
+ FractionFormat f = new FractionFormat("", "9999999999999999999999999999");
+ double val = 321.321;
+ String ret = f.format(val);
+ assertEquals("26027/81", ret);
+ }
+
+ @Ignore("Runs for some longer time")
+ @Test
+ public void microBenchmark() {
+ FractionFormat f = new FractionFormat("", "##");
+ double val = 321.321;
+ for(int i = 0;i < 1000000;i++) {
+ String ret = f.format(val);
+ assertEquals("26027/81", ret);
+ }
+ }
+
@Test
- public void testWithBigWholePart() throws Exception {
+ public void testWithBigWholePart() {
FractionFormat f = new FractionFormat("#", "???/???");
assertEquals("10100136259702", f.format(10100136259702d));