aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2020-11-01 09:21:16 +0000
committerDominik Stadler <centic@apache.org>2020-11-01 09:21:16 +0000
commit5226ed80dd87ca47e3f97798e974b4235ad3ba75 (patch)
treecb73f455bd873d58f9747721d9a5f44f47f89565 /src/testcases
parenta080d2b0983c7b385e331a620fd5867741f3b7d6 (diff)
downloadpoi-5226ed80dd87ca47e3f97798e974b4235ad3ba75.tar.gz
poi-5226ed80dd87ca47e3f97798e974b4235ad3ba75.zip
Improve error messages on missing Factory-implementations, fix Sonar issues and IDE warnings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1883035 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestNameRecord.java3
-rw-r--r--src/testcases/org/apache/poi/ss/formula/eval/BaseTestCircularReferences.java3
-rw-r--r--src/testcases/org/apache/poi/util/TestLocaleUtil.java28
3 files changed, 15 insertions, 19 deletions
diff --git a/src/testcases/org/apache/poi/hssf/record/TestNameRecord.java b/src/testcases/org/apache/poi/hssf/record/TestNameRecord.java
index 6ddc194a11..7dfdf4f8ee 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestNameRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestNameRecord.java
@@ -18,7 +18,6 @@
package org.apache.poi.hssf.record;
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
-import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
@@ -115,8 +114,6 @@ public final class TestNameRecord {
"EQpiGoagbEQ3NMJCVEMSJiIMhTAMjxdcz2ERGmIaBqEiuqERElENSQhEGMrT+APX2vm3iyMAAA=="
);
- assertArrayEquals(data1, data1);
-
RecordInputStream in1 = TestcaseRecordInputStream.create(data1);
NameRecord nr1 = new NameRecord(in1);
assert_bug50244(nr1);
diff --git a/src/testcases/org/apache/poi/ss/formula/eval/BaseTestCircularReferences.java b/src/testcases/org/apache/poi/ss/formula/eval/BaseTestCircularReferences.java
index fc499d2277..ef9ab269e8 100644
--- a/src/testcases/org/apache/poi/ss/formula/eval/BaseTestCircularReferences.java
+++ b/src/testcases/org/apache/poi/ss/formula/eval/BaseTestCircularReferences.java
@@ -175,7 +175,7 @@ public abstract class BaseTestCircularReferences {
fe.clearAllCachedResultValues();
cv = fe.evaluate(cellB1);
// Identified bug 46898
- assertNotEquals(cv.getCellType(), ErrorEval.CIRCULAR_REF_ERROR.getErrorCode());
+ assertNotEquals(cv.getErrorValue(), ErrorEval.CIRCULAR_REF_ERROR.getErrorCode());
assertEquals(CellType.NUMERIC, cv.getCellType());
assertEquals(46.0, cv.getNumberValue(), 0.0);
@@ -184,7 +184,6 @@ public abstract class BaseTestCircularReferences {
cv = fe.evaluate(cellE1);
assertEquals(CellType.NUMERIC, cv.getCellType());
assertEquals(43.0, cv.getNumberValue(), 0.0);
-
}
}
}
diff --git a/src/testcases/org/apache/poi/util/TestLocaleUtil.java b/src/testcases/org/apache/poi/util/TestLocaleUtil.java
index 3a7c65a6a7..aeb79b973c 100644
--- a/src/testcases/org/apache/poi/util/TestLocaleUtil.java
+++ b/src/testcases/org/apache/poi/util/TestLocaleUtil.java
@@ -36,7 +36,7 @@ public class TestLocaleUtil {
private static final Locale ja_JP = Locale.JAPAN;
private static final TimeZone TOKYO = TimeZone.getTimeZone("Asia/Tokyo");
private static final Calendar JAPAN_CALENDAR = Calendar.getInstance(TOKYO, ja_JP);
-
+
/**
* Reset the Locale to the user default before the test so that it isn't influenced
* by the LocaleUtil's state being changed by previous tests.
@@ -51,7 +51,7 @@ public class TestLocaleUtil {
// http://www.codeaffine.com/2014/07/21/a-junit-rule-to-run-a-test-in-its-own-thread/
LocaleUtil.setUserLocale(Locale.getDefault());
LocaleUtil.setUserTimeZone(TimeZone.getDefault());
-
+
assumeFalse(ja_JP.equals(LocaleUtil.getUserLocale()));
assumeFalse(TOKYO.equals(LocaleUtil.getUserTimeZone()));
}
@@ -65,48 +65,48 @@ public class TestLocaleUtil {
LocaleUtil.resetUserLocale();
LocaleUtil.resetUserTimeZone();
}
-
+
@Test
@SuppressForbidden("implementation around default locales in POI")
public void userLocale() {
Locale DEFAULT_LOCALE = LocaleUtil.getUserLocale();
-
+
assertEquals(DEFAULT_LOCALE, LocaleUtil.getUserLocale());
assertNotEquals(ja_JP, LocaleUtil.getUserLocale());
-
+
LocaleUtil.setUserLocale(ja_JP);
assertEquals(ja_JP, LocaleUtil.getUserLocale());
-
+
LocaleUtil.resetUserLocale();
assertEquals(DEFAULT_LOCALE, LocaleUtil.getUserLocale());
}
-
+
@Test
@SuppressForbidden("implementation around default locales in POI")
public void userTimeZone() {
TimeZone DEFAULT_TIME_ZONE = LocaleUtil.getUserTimeZone();
-
+
assertEquals(DEFAULT_TIME_ZONE, LocaleUtil.getUserTimeZone());
- assertNotEquals(TOKYO, LocaleUtil.getUserLocale());
-
+ assertNotEquals(TOKYO, LocaleUtil.getUserTimeZone());
+
LocaleUtil.setUserTimeZone(TOKYO);
assertEquals(TOKYO, LocaleUtil.getUserTimeZone());
}
-
+
@Test
@SuppressForbidden("implementation around default locales in POI")
public void localeCalendar() {
Locale DEFAULT_LOCALE = LocaleUtil.getUserLocale();
TimeZone DEFAULT_TIME_ZONE = LocaleUtil.getUserTimeZone();
Calendar DEFAULT_CALENDAR = LocaleUtil.getLocaleCalendar();
-
+
assertEquals(DEFAULT_LOCALE, LocaleUtil.getUserLocale());
assertEquals(DEFAULT_TIME_ZONE, LocaleUtil.getUserTimeZone());
assertCalendarEquals(DEFAULT_CALENDAR, LocaleUtil.getLocaleCalendar());
assertNotEquals(ja_JP, LocaleUtil.getUserLocale());
assertNotEquals(TOKYO, LocaleUtil.getUserTimeZone());
assertCalendarNotEquals(JAPAN_CALENDAR, LocaleUtil.getLocaleCalendar());
-
+
LocaleUtil.setUserLocale(ja_JP);
LocaleUtil.setUserTimeZone(TOKYO);
assertCalendarEquals(JAPAN_CALENDAR, LocaleUtil.getLocaleCalendar());
@@ -115,7 +115,7 @@ public class TestLocaleUtil {
//assertCalendarEquals(JAPAN_CALENDAR, LocaleUtil.getLocaleCalendar(2016, 00, 01));
//assertCalendarEquals(JAPAN_CALENDAR, LocaleUtil.getLocaleCalendar(2016, 00, 01, 00, 00, 00));
}
-
+
private static void assertCalendarNotEquals(Calendar expected, Calendar actual) {
// FIXME: add more tests to compare calendars, ignoring whether the dates are equal
assertNotEquals("time zone", expected.getTimeZone(), actual.getTimeZone());