poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1598225 - in /poi/trunk/src/excelant: java/org/apache/poi/ss/excelant/ExcelAntTask.java testcases/org/apache/poi/ss/excelant/TestBuildFile.java testcases/org/apache/poi/ss/excelant/tests.xml
Date Thu, 29 May 2014 09:15:34 GMT
Author: centic
Date: Thu May 29 09:15:33 2014
New Revision: 1598225

URL: http://svn.apache.org/r1598225
Log:
Remove null-checks that can never be reached
add test for ExcelAnt setString

Modified:
    poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java
    poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java
    poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/tests.xml

Modified: poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java?rev=1598225&r1=1598224&r2=1598225&view=diff
==============================================================================
--- poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java (original)
+++ poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java Thu May 29 09:15:33
2014
@@ -105,7 +105,7 @@ public class ExcelAntTask extends Task {
 					            Project.MSG_ERR ) ;
 			return ;
 		}
-		if( tests != null && tests.size() > 0 ) {
+		if( tests.size() > 0 ) {
 			
 			Iterator<ExcelAntTest> testsIt = tests.iterator() ;
 			while( testsIt.hasNext() ) {
@@ -115,15 +115,13 @@ public class ExcelAntTask extends Task {
 		
 				workbookUtil = ExcelAntWorkbookUtilFactory.getInstance( excelFileName ) ;
 				
-				if( functions != null ) {
-					Iterator<ExcelAntUserDefinedFunction> functionsIt = functions.iterator() ;
-					while( functionsIt.hasNext() ) {
-						ExcelAntUserDefinedFunction eaUdf = functionsIt.next() ;
-						try {
-							workbookUtil.addFunction(eaUdf.getFunctionAlias(), eaUdf.getClassName() ) ;
-						} catch ( Exception e) {
-							throw new BuildException( e.getMessage(), e ); 
- 						}
+				Iterator<ExcelAntUserDefinedFunction> functionsIt = functions.iterator() ;
+				while( functionsIt.hasNext() ) {
+					ExcelAntUserDefinedFunction eaUdf = functionsIt.next() ;
+					try {
+						workbookUtil.addFunction(eaUdf.getFunctionAlias(), eaUdf.getClassName() ) ;
+					} catch ( Exception e) {
+						throw new BuildException( e.getMessage(), e ); 
 					}
 				}
 				test.setWorkbookUtil( workbookUtil ) ;
@@ -158,16 +156,14 @@ public class ExcelAntTask extends Task {
                                      getLocation());
         }
 
-		Workbook workbook;
 		File workbookFile = new File( excelFileName ) ;
         try {
             FileInputStream fis = new FileInputStream( workbookFile ) ;
-            workbook = WorkbookFactory.create( fis ) ;
+            return WorkbookFactory.create( fis ) ;
         } catch (Exception e) {
             throw new BuildException("Cannot load file " + excelFileName
                     + ". Make sure the path and file permissions are correct.", e, getLocation());
         }
-		return workbook ;
 	}
 
 

Modified: poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java?rev=1598225&r1=1598224&r2=1598225&view=diff
==============================================================================
--- poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java (original)
+++ poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java Thu May
29 09:15:33 2014
@@ -73,4 +73,9 @@ public class TestBuildFile extends Build
         executeTarget("test-udf");
         assertLogContaining("1/1 tests passed");
     }
+    
+    public void testSetText() {
+        executeTarget("test-settext");
+        assertLogContaining("1/1 tests passed");
+    }
 }

Modified: poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/tests.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/tests.xml?rev=1598225&r1=1598224&r2=1598225&view=diff
==============================================================================
--- poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/tests.xml (original)
+++ poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/tests.xml Thu May 29 09:15:33
2014
@@ -135,4 +135,14 @@ under the License.
          </poi:excelant>
       </target>
 
+    <!-- basic evaluation test -->
+    <target name="test-settext">
+        <poi:excelant fileName="${data.dir.name}/spreadsheet/excelant.xls">
+            <poi:test showSuccessDetails="true">
+                <poi:setString cell="'MortgageCalculator'!$B$1" value="sometext"/>
+            	<!-- How can we evaluate text? -->
+            </poi:test>
+         </poi:excelant>
+      </target>
+
 </project>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message