diff options
author | Dominik Stadler <centic@apache.org> | 2021-12-30 16:10:52 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2021-12-30 16:10:52 +0000 |
commit | 32311e42c2fb1403b165fdda5cbd46d9869f561e (patch) | |
tree | 78eb2526f5cf1f33a8645002b9eace607014e609 /poi-scratchpad/src | |
parent | 6aa1e58bdfd1b2ec402598c829b8b56d7e868ad7 (diff) | |
download | poi-32311e42c2fb1403b165fdda5cbd46d9869f561e.tar.gz poi-32311e42c2fb1403b165fdda5cbd46d9869f561e.zip |
Fix Sonar issues and print out some more in test-assertions that do fail sometimes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896531 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-scratchpad/src')
-rw-r--r-- | poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestTextRun.java | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestTextRun.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestTextRun.java index 46939beec4..f325f2cf92 100644 --- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestTextRun.java +++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestTextRun.java @@ -46,7 +46,6 @@ import org.apache.poi.sl.usermodel.BaseTestSlideShow; import org.apache.poi.sl.usermodel.PlaceholderDetails; import org.apache.poi.util.LocaleUtil; import org.junit.jupiter.api.Test; -import org.opentest4j.AssertionFailedError; /** * Tests for TextRuns @@ -464,7 +463,6 @@ public final class TestTextRun { shape2.setText("Text 2"); slide.addShape(shape2); - runs = slide.getTextParagraphs(); assertEquals(2, runs.size()); assertSame(run1, runs.get(0)); @@ -541,6 +539,7 @@ public final class TestTextRun { assertTrue(runs.stream().map(HSLFTextRun::getFontFamily).allMatch("Arial"::equals)); int[] exp = {36, 24, 12, 32, 12, 12}; + //noinspection ConstantConditions int[] act = runs.stream().map(HSLFTextRun::getFontSize).mapToInt(Double::intValue).toArray(); assertArrayEquals(exp, act); } @@ -610,15 +609,12 @@ public final class TestTextRun { for (Map.Entry<Locale,String[]> me : formats.entrySet()) { LocaleUtil.setUserLocale(me.getKey()); - try { - // refresh internal members - phs.forEach(PlaceholderDetails::getPlaceholder); + // refresh internal members + phs.forEach(PlaceholderDetails::getPlaceholder); - String[] actDate = phs.stream().map(PlaceholderDetails::getDateFormat).map(ldt::format).toArray(String[]::new); - assertArrayEquals(me.getValue(), actDate); - } catch (AssertionFailedError e) { - throw new AssertionFailedError("While handling local " + me.getKey()); - } + String[] actDate = phs.stream().map(PlaceholderDetails::getDateFormat).map(ldt::format).toArray(String[]::new); + assertArrayEquals(me.getValue(), actDate, + "While handling local " + me.getKey()); } } finally { LocaleUtil.resetUserLocale(); |