From 3575cee028ce5ac6ad8f4d5c8f3a5339427252e1 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Mon, 29 Jan 2018 15:21:59 +0000 Subject: [PATCH] [bug-62038] add mockito based unit test git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1822517 13f79535-47bb-0310-9956-ffa450edef68 --- .classpath | 1 + build.gradle | 1 + build.xml | 5 +++++ gradle/wrapper/gradle-wrapper.jar | Bin 54212 -> 54212 bytes .../poi/xslf/usermodel/TestXSLFTextRun.java | 15 +++++++++++++++ 5 files changed, 22 insertions(+) diff --git a/.classpath b/.classpath index 04c9319915..bfe9ee244c 100644 --- a/.classpath +++ b/.classpath @@ -35,5 +35,6 @@ + diff --git a/build.gradle b/build.gradle index e209e7a54a..cf32c436f6 100644 --- a/build.gradle +++ b/build.gradle @@ -211,6 +211,7 @@ project('ooxml') { compile files('../../ooxml-lib/ooxml-security-1.1.jar') testCompile 'junit:junit:4.12' + testCompile 'org.mockito:mockito-core:2.13.0' testCompile project(path: ':main', configuration: 'tests') testCompile 'org.openjdk.jmh:jmh-core:1.19' testCompile 'org.openjdk.jmh:jmh-generator-annprocess:1.19' diff --git a/build.xml b/build.xml index 10462ee1e4..8a4dc2531a 100644 --- a/build.xml +++ b/build.xml @@ -164,6 +164,8 @@ under the License. + + @@ -317,6 +319,7 @@ under the License. + @@ -620,6 +623,7 @@ under the License. + @@ -651,6 +655,7 @@ under the License. + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 314d6ec1b8a91189216eb039956ae86695e1d0d9..849557c7efca08a5f9c5a572c4024f847783705c 100644 GIT binary patch delta 26 gcmX@IocYLd<_)ojn2RcGHzynt5d<+NmtXb;0G#s+Bme*a delta 26 gcmX@IocYLd<_)ojm=`2iZB95OA_!tkF2C#x0G{LvN&o-= diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextRun.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextRun.java index 1640d499e8..9c0c1b6b58 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextRun.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextRun.java @@ -22,6 +22,8 @@ import static org.apache.poi.sl.TestCommonSL.sameColor; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.awt.Color; import java.io.IOException; @@ -96,4 +98,17 @@ public class TestXSLFTextRun { assertEquals(unicodeSurrogates, r.getRenderableText(unicodeSurrogates)); } } + + @Test + public void testCopyNullFontSize() throws IOException { + XMLSlideShow ppt = new XMLSlideShow(); + XSLFSlide slide = ppt.createSlide(); + XSLFTextShape sh = slide.createAutoShape(); + + XSLFTextRun r = sh.addNewTextParagraph().addNewTextRun(); + XSLFTextRun s = mock(XSLFTextRun.class); + when(s.getFontSize()).thenReturn(null); + + r.copy(s); + } }