Return-Path: X-Original-To: apmail-poi-commits-archive@minotaur.apache.org Delivered-To: apmail-poi-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D0A34184F9 for ; Wed, 6 Apr 2016 06:01:30 +0000 (UTC) Received: (qmail 43662 invoked by uid 500); 6 Apr 2016 06:01:30 -0000 Delivered-To: apmail-poi-commits-archive@poi.apache.org Received: (qmail 43624 invoked by uid 500); 6 Apr 2016 06:01:30 -0000 Mailing-List: contact commits-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@poi.apache.org Delivered-To: mailing list commits@poi.apache.org Received: (qmail 43612 invoked by uid 99); 6 Apr 2016 06:01:30 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Apr 2016 06:01:30 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id F1FBB1A4936 for ; Wed, 6 Apr 2016 06:01:29 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.999 X-Spam-Level: X-Spam-Status: No, score=0.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id y7FhzBv7LLxT for ; Wed, 6 Apr 2016 06:01:29 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTP id 5F3E65F54E for ; Wed, 6 Apr 2016 06:01:28 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 4338DE0222 for ; Wed, 6 Apr 2016 06:01:27 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 1D94F3A0220 for ; Wed, 6 Apr 2016 06:01:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1737923 - /poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java Date: Wed, 06 Apr 2016 06:01:26 -0000 To: commits@poi.apache.org From: onealj@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160406060127.1D94F3A0220@svn01-us-west.apache.org> Author: onealj Date: Wed Apr 6 06:01:26 2016 New Revision: 1737923 URL: http://svn.apache.org/viewvc?rev=1737923&view=rev Log: add test coverage for TestSXSSFCell.toString() on blank and date cells Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java?rev=1737923&r1=1737922&r2=1737923&view=diff ============================================================================== --- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java (original) +++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java Wed Apr 6 06:01:26 2016 @@ -294,12 +294,28 @@ public abstract class BaseTestCell { r.createCell(2).setCellValue(factory.createRichTextString("Astring")); r.createCell(3).setCellErrorValue(FormulaError.DIV0.getCode()); r.createCell(4).setCellFormula("A1+B1"); + r.createCell(5); // blank + + // create date-formatted cell + Calendar c = LocaleUtil.getLocaleCalendar(); + c.set(2010, 01, 02, 00, 00, 00); + r.createCell(6).setCellValue(c); + CellStyle dateStyle = wb1.createCellStyle(); + short formatId = wb1.getCreationHelper().createDataFormat().getFormat("m/d/yy h:mm"); // any date format will do + dateStyle.setDataFormat(formatId); + r.getCell(6).setCellStyle(dateStyle); assertEquals("Boolean", "TRUE", r.getCell(0).toString()); assertEquals("Numeric", "1.5", r.getCell(1).toString()); assertEquals("String", "Astring", r.getCell(2).toString()); assertEquals("Error", "#DIV/0!", r.getCell(3).toString()); assertEquals("Formula", "A1+B1", r.getCell(4).toString()); + assertEquals("Blank", "", r.getCell(5).toString()); + // toString on a date-formatted cell displays dates as dd-MMM-yyyy, which has locale problems with the month + String dateCell1 = r.getCell(6).toString(); + assertTrue("Date (Day)", dateCell1.startsWith("02-")); + assertTrue("Date (Year)", dateCell1.endsWith("-2010")); + //Write out the file, read it in, and then check cell values Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1); @@ -311,6 +327,9 @@ public abstract class BaseTestCell { assertEquals("String", "Astring", r.getCell(2).toString()); assertEquals("Error", "#DIV/0!", r.getCell(3).toString()); assertEquals("Formula", "A1+B1", r.getCell(4).toString()); + assertEquals("Blank", "", r.getCell(5).toString()); + String dateCell2 = r.getCell(6).toString(); + assertEquals("Date", dateCell1, dateCell2); wb2.close(); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org