poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From one...@apache.org
Subject svn commit: r1795296 - in /poi/trunk/src: excelant/testcases/org/apache/poi/ss/excelant/ java/org/apache/poi/hssf/usermodel/ java/org/apache/poi/ss/util/ ooxml/java/org/apache/poi/ ooxml/java/org/apache/poi/util/ ooxml/java/org/apache/poi/xssf/usermode...
Date Tue, 16 May 2017 10:53:15 GMT
Author: onealj
Date: Tue May 16 10:53:15 2017
New Revision: 1795296

URL: http://svn.apache.org/viewvc?rev=1795296&view=rev
Log:
replace "String.indexOf(String) >= 1" with "String.contains(String)"

Modified:
    poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/BuildFileTest.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HeaderFooter.java
    poi/trunk/src/java/org/apache/poi/ss/util/AreaReference.java
    poi/trunk/src/java/org/apache/poi/ss/util/CellReference.java
    poi/trunk/src/ooxml/java/org/apache/poi/POIXMLRelation.java
    poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/RecipientChunks.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/parsers/POIFSChunkParser.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestOutlookTextExtractor.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestOle10Native.java

Modified: poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/BuildFileTest.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/BuildFileTest.java?rev=1795296&r1=1795295&r2=1795296&view=diff
==============================================================================
--- poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/BuildFileTest.java (original)
+++ poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/BuildFileTest.java Tue May
16 10:53:15 2017
@@ -18,6 +18,9 @@
 
 package org.apache.poi.ss.excelant;
 
+import static org.apache.poi.POITestCase.assertContains;
+import static org.apache.poi.POITestCase.assertNotContained;
+
 import java.io.File;
 import java.io.PrintStream;
 import java.net.URL;
@@ -119,20 +122,14 @@ public abstract class BuildFileTest exte
      * Assert that the given substring is in the log messages.
      */
     public void assertLogContaining(String substring) {
-        String realLog = getLog();
-        assertTrue("expecting log to contain \"" + substring + "\" log was \""
-                + realLog + "\"",
-                realLog.indexOf(substring) >= 0);
+        assertContains(getLog(), substring);
     }
 
     /**
      * Assert that the given substring is not in the log messages.
      */
     public void assertLogNotContaining(String substring) {
-        String realLog = getLog();
-        assertFalse("didn't expect log to contain \"" + substring + "\" log was \""
-                + realLog + "\"",
-                realLog.indexOf(substring) >= 0);
+        assertNotContained(getLog(), substring);
     }
 
     /**
@@ -152,11 +149,7 @@ public abstract class BuildFileTest exte
      * @since Ant1.7
      */
     public void assertOutputContaining(String message, String substring) {
-        String realOutput = getOutput();
-        String realMessage = (message != null)
-                ? message
-                : "expecting output to contain \"" + substring + "\" output was \"" + realOutput
+ "\"";
-        assertTrue(realMessage, realOutput.indexOf(substring) >= 0);
+        assertContains("output: " + message, getOutput(), substring);
     }
 
     /**
@@ -167,11 +160,7 @@ public abstract class BuildFileTest exte
      * @since Ant1.7
      */
     public void assertOutputNotContaining(String message, String substring) {
-        String realOutput = getOutput();
-        String realMessage = (message != null)
-                ? message
-                : "expecting output to not contain \"" + substring + "\" output was \"" +
realOutput + "\"";
-        assertFalse(realMessage, realOutput.indexOf(substring) >= 0);
+        assertNotContained(getOutput(), substring);
     }
 
     /**
@@ -218,10 +207,10 @@ public abstract class BuildFileTest exte
      */
     public void assertDebuglogContaining(String substring) {
         String realLog = getFullLog();
-        assertTrue("expecting debug log to contain \"" + substring
+        assertContains("expecting debug log to contain \"" + substring
                 + "\" log was \""
                 + realLog + "\"",
-                realLog.indexOf(substring) >= 0);
+                realLog, substring);
     }
 
     /**
@@ -397,7 +386,7 @@ public abstract class BuildFileTest exte
             executeTarget(target);
         } catch (org.apache.tools.ant.BuildException ex) {
             buildException = ex;
-            if ((null != contains) && (ex.getMessage().indexOf(contains) == -1))
{
+            if ((null != contains) && (!ex.getMessage().contains(contains))) {
                 fail("Should throw BuildException because '" + cause + "' with message containing
'" + contains + "' (actual message '" + ex.getMessage() + "' instead)");
             }
             return;

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HeaderFooter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HeaderFooter.java?rev=1795296&r1=1795295&r2=1795296&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HeaderFooter.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HeaderFooter.java Tue May 16 10:53:15
2017
@@ -40,6 +40,7 @@ public abstract class HeaderFooter imple
 		String _center = "";
 		String _right = "";
 
+// FIXME: replace outer goto. just eww.
 outer:
 		while (text.length() > 1) {
 			if (text.charAt(0) != '&') {
@@ -50,30 +51,30 @@ outer:
 			int pos = text.length();
 			switch (text.charAt(1)) {
 			case 'L':
-				if (text.indexOf("&C") >= 0) {
+				if (text.contains("&C")) {
 					pos = Math.min(pos, text.indexOf("&C"));
 				}
-				if (text.indexOf("&R") >= 0) {
+				if (text.contains("&R")) {
 					pos = Math.min(pos, text.indexOf("&R"));
 				}
 				_left = text.substring(2, pos);
 				text = text.substring(pos);
 				break;
 			case 'C':
-				if (text.indexOf("&L") >= 0) {
+				if (text.contains("&L")) {
 					pos = Math.min(pos, text.indexOf("&L"));
 				}
-				if (text.indexOf("&R") >= 0) {
+				if (text.contains("&R")) {
 					pos = Math.min(pos, text.indexOf("&R"));
 				}
 				_center = text.substring(2, pos);
 				text = text.substring(pos);
 				break;
 			case 'R':
-				if (text.indexOf("&C") >= 0) {
+				if (text.contains("&C")) {
 					pos = Math.min(pos, text.indexOf("&C"));
 				}
-				if (text.indexOf("&L") >= 0) {
+				if (text.contains("&L")) {
 					pos = Math.min(pos, text.indexOf("&L"));
 				}
 				_right = text.substring(2, pos);
@@ -288,7 +289,7 @@ outer:
 		// Firstly, do the easy ones which are static
 		for (MarkupTag mt : MarkupTag.values()) {
 			String seq = mt.getRepresentation();
-			while ((pos = text.indexOf(seq)) > -1) {
+			while ((pos = text.indexOf(seq)) >= 0) {
 				text = text.substring(0, pos) + text.substring(pos + seq.length());
 			}
 		}

Modified: poi/trunk/src/java/org/apache/poi/ss/util/AreaReference.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/AreaReference.java?rev=1795296&r1=1795295&r2=1795296&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/AreaReference.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/AreaReference.java Tue May 16 10:53:15 2017
@@ -176,10 +176,7 @@ public class AreaReference {
        }
 
        // Check for the , as a sign of non-coniguous
-       if(reference.indexOf(',') == -1) {
-          return true;
-       }
-       return false;
+       return !reference.contains(",");
     }
 
     public static AreaReference getWholeRow(SpreadsheetVersion version, String start, String
end) {
@@ -387,7 +384,8 @@ public class AreaReference {
 
         String partA = reference.substring(0, delimiterPos);
         String partB = reference.substring(delimiterPos+1);
-        if(partB.indexOf(SHEET_NAME_DELIMITER) >=0) {
+        if(partB.indexOf(SHEET_NAME_DELIMITER) >= 0) {
+            // partB contains SHEET_NAME_DELIMITER
             // TODO - are references like "Sheet1!A1:Sheet1:B2" ever valid?  
             // FormulaParser has code to handle that.
             

Modified: poi/trunk/src/java/org/apache/poi/ss/util/CellReference.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/CellReference.java?rev=1795296&r1=1795295&r2=1795296&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/CellReference.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/CellReference.java Tue May 16 10:53:15 2017
@@ -408,7 +408,7 @@ public class CellReference {
         boolean isQuoted = reference.charAt(0) == SPECIAL_NAME_DELIMITER;
         if(!isQuoted) {
             // sheet names with spaces must be quoted
-            if (reference.indexOf(' ') == -1) {
+            if (! reference.contains(" ")) {
                 return reference.substring(0, indexOfSheetNameDelimiter);
             } else {
                 throw new IllegalArgumentException("Sheet names containing spaces must be
quoted: (" + reference + ")");

Modified: poi/trunk/src/ooxml/java/org/apache/poi/POIXMLRelation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/POIXMLRelation.java?rev=1795296&r1=1795295&r2=1795296&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLRelation.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/POIXMLRelation.java Tue May 16 10:53:15 2017
@@ -119,7 +119,7 @@ public abstract class POIXMLRelation {
      * @return the filename including the suffix
      */
     public String getFileName(int index) {
-        if(_defaultName.indexOf("#") == -1) {
+        if(! _defaultName.contains("#")) {
             // Generic filename in all cases
             return getDefaultFileName();
         }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java?rev=1795296&r1=1795295&r2=1795296&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java Tue May 16 10:53:15 2017
@@ -278,7 +278,9 @@ public final class OOXMLLite {
                 if (loc == null) continue;
                 
                 String jar = loc.toString();
-                if(jar.indexOf(ptrn) != -1) map.put(cls.getName(), cls);
+                if (jar.contains(ptrn)) {
+                    map.put(cls.getName(), cls);
+                }
             }
             return map;
         } catch (IllegalAccessException e) {
@@ -299,4 +301,4 @@ public final class OOXMLLite {
         }
     }
 
-}
\ No newline at end of file
+}

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java?rev=1795296&r1=1795295&r2=1795296&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java Tue May 16 10:53:15
2017
@@ -111,7 +111,7 @@ public class XSSFComment implements Comm
         boolean visible = false;
         if(_vmlShape != null){
             String style = _vmlShape.getStyle();
-            visible = style != null && style.indexOf("visibility:visible") != -1;
+            visible = style != null && style.contains("visibility:visible");
         }
         return visible;
     }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/RecipientChunks.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/RecipientChunks.java?rev=1795296&r1=1795295&r2=1795296&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/RecipientChunks.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/RecipientChunks.java Tue May
16 10:53:15 2017
@@ -124,7 +124,7 @@ public final class RecipientChunks imple
         if (recipientEmailChunk != null) {
             String email = recipientEmailChunk.getValue();
             int cne = email.indexOf("/CN=");
-            if (cne == -1) {
+            if (cne < 0) {
                 // Normal smtp address
                 return email;
             } else {
@@ -136,7 +136,7 @@ public final class RecipientChunks imple
         // Might be in the name field, check there
         if (recipientNameChunk != null) {
             String name = recipientNameChunk.getValue();
-            if (name.indexOf('@') > -1) {
+            if (name.contains("@")) {
                 // Strip leading and trailing quotes if needed
                 if (name.startsWith("'") && name.endsWith("'")) {
                     return name.substring(1, name.length() - 1);
@@ -149,8 +149,9 @@ public final class RecipientChunks imple
         // encoded as a SMTP destination in there.
         if (recipientSearchChunk != null) {
             String search = recipientSearchChunk.getAs7bitString();
-            if (search.indexOf("SMTP:") != -1) {
-                return search.substring(search.indexOf("SMTP:") + 5);
+            int idx = search.indexOf("SMTP:");
+            if (idx >= 0) {
+                return search.substring(idx + 5);
             }
         }
 

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/parsers/POIFSChunkParser.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/parsers/POIFSChunkParser.java?rev=1795296&r1=1795295&r2=1795296&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/parsers/POIFSChunkParser.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/parsers/POIFSChunkParser.java Tue May
16 10:53:15 2017
@@ -140,7 +140,7 @@ public final class POIFSChunkParser {
             // Name in the wrong format
             return;
          }
-         if(entryName.indexOf('_') == -1) {
+         if(! entryName.contains("_")) {
             // Name in the wrong format
             return;
          }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestOutlookTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestOutlookTextExtractor.java?rev=1795296&r1=1795295&r2=1795296&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestOutlookTextExtractor.java
(original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestOutlookTextExtractor.java
Tue May 16 10:53:15 2017
@@ -64,9 +64,9 @@ public final class TestOutlookTextExtrac
       
       assertContains(text, "From: Kevin Roast\n");
       assertContains(text, "To: Kevin Roast <kevin.roast@alfresco.org>\n");
-      assertEquals(-1, text.indexOf("CC:"));
-      assertEquals(-1, text.indexOf("BCC:"));
-      assertEquals(-1, text.indexOf("Attachment:"));
+      assertNotContained(text, "CC:");
+      assertNotContained(text, "BCC:");
+      assertNotContained(text, "Attachment:");
       assertContains(text, "Subject: Test the content transformer\n");
       Calendar cal = LocaleUtil.getLocaleCalendar(2007, 5, 14, 9, 42, 55);
       SimpleDateFormat f = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss Z", Locale.ROOT);
@@ -89,8 +89,8 @@ public final class TestOutlookTextExtrac
       
       assertContains(text, "From: Travis Ferguson\n");
       assertContains(text, "To: travis@overwrittenstack.com\n");
-      assertEquals(-1, text.indexOf("CC:"));
-      assertEquals(-1, text.indexOf("BCC:"));
+      assertNotContained(text, "CC:");
+      assertNotContained(text, "BCC:");
       assertContains(text, "Subject: test message\n");
       assertContains(text, "Date: Fri, 6 Jul 2007 05:27:17 +0000\n");
       assertContains(text, "This is a test message.");
@@ -193,7 +193,7 @@ public final class TestOutlookTextExtrac
                "'Paul Holmes-Higgin' <paul.hh@alfresco.com>; 'Mike Farman' <mikef@alfresco.com>\n");
          assertContains(text, "CC: nickb@alfresco.com; " +
                "nick.burch@alfresco.com; 'Roy Wetherall' <roy.wetherall@alfresco.com>\n");
-         assertEquals(-1, text.indexOf("BCC:"));
+         assertNotContained(text, "BCC:");
          assertContains(text, "Subject: This is a test message please ignore\n");
          assertContains(text, "Date: Mon, 11 Jan 2010 16:2"); // Exact times differ slightly
          assertContains(text, "The quick brown fox jumps over the lazy dog");
@@ -216,8 +216,8 @@ public final class TestOutlookTextExtrac
       
       assertContains(text, "From: Nicolas1");
       assertContains(text, "To: 'nicolas1.23456@free.fr'");
-      assertEquals(-1, text.indexOf("CC:"));
-      assertEquals(-1, text.indexOf("BCC:"));
+      assertNotContained(text, "CC:");
+      assertNotContained(text, "BCC:");
       assertContains(text, "Subject: test");
       assertContains(text, "Date: Wed, 22 Apr");
       assertContains(text, "Attachment: test-unicode.doc\n");

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java?rev=1795296&r1=1795295&r2=1795296&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java Tue
May 16 10:53:15 2017
@@ -162,7 +162,7 @@ public final class TestProblems extends
             String text = para.text();
 
             totalLength += text.length();
-            if (text.indexOf("{delete me}") > -1) {
+            if (text.contains("{delete me}")) {
                 para.delete();
                 deletedLength = text.length();
             }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java?rev=1795296&r1=1795295&r2=1795296&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java Tue May
16 10:53:15 2017
@@ -64,7 +64,7 @@ public final class TestEscherGraphics {
     @Test
     public void testGetFont() {
         Font f = graphics.getFont();
-        if (f.toString().indexOf("dialog") == -1 && f.toString().indexOf("Dialog")
== -1) {
+        if (! f.toString().contains("dialog") && ! f.toString().contains("Dialog"))
{
             assertEquals("java.awt.Font[family=Arial,name=Arial,style=plain,size=10]", f.toString());
         }
     }
@@ -72,7 +72,7 @@ public final class TestEscherGraphics {
     @Test
     public void testGetFontMetrics() {
         Font f = graphics.getFont();
-        if (f.toString().indexOf("dialog") != -1 || f.toString().indexOf("Dialog") != -1)
{
+        if (f.toString().contains("dialog") || f.toString().contains("Dialog")) {
             return;
         }
         FontMetrics fontMetrics = graphics.getFontMetrics(graphics.getFont());

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java?rev=1795296&r1=1795295&r2=1795296&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java Tue
May 16 10:53:15 2017
@@ -17,6 +17,8 @@
 
 package org.apache.poi.poifs.filesystem;
 
+import static org.apache.poi.POITestCase.assertContains;
+
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -45,8 +47,8 @@ public class TestOfficeXMLException exte
 			fail("expected exception was not thrown");
 		} catch(OfficeXmlFileException e) {
 			// expected during successful test
-			assertTrue(e.getMessage().indexOf("The supplied data appears to be in the Office 2007+
XML") > -1);
-			assertTrue(e.getMessage().indexOf("You are calling the part of POI that deals with OLE2
Office Documents") > -1);
+			assertContains(e.getMessage(), "The supplied data appears to be in the Office 2007+ XML");
+			assertContains(e.getMessage(), "You are calling the part of POI that deals with OLE2 Office
Documents");
 		}
 	}
     public void test2003XMLException() throws IOException
@@ -58,8 +60,8 @@ public class TestOfficeXMLException exte
             fail("expected exception was not thrown");
         } catch(NotOLE2FileException e) {
             // expected during successful test
-            assertTrue(e.getMessage().indexOf("The supplied data appears to be a raw XML
file") > -1);
-            assertTrue(e.getMessage().indexOf("Formats such as Office 2003 XML") > -1);
+            assertContains(e.getMessage(), "The supplied data appears to be a raw XML file");
+            assertContains(e.getMessage(), "Formats such as Office 2003 XML");
         }
     }
 	

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestOle10Native.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestOle10Native.java?rev=1795296&r1=1795295&r2=1795296&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestOle10Native.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestOle10Native.java Tue May 16
10:53:15 2017
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.apache.poi.POITestCase.assertContains;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -118,7 +119,7 @@ public class TestOle10Native {
             Ole10Native.createFromEmbeddedOleObject(fs);
             fail("Should have thrown exception because OLENative lacks a length parameter");
         } catch (Ole10NativeException e) {
-            assertTrue(e.getMessage().indexOf("declared data length") > -1);
+            assertContains(e.getMessage(), "declared data length");
         }
     }
 



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


Mime
View raw message