Use assertContains instead of assertTrue(text.contains) for better error messages on failure
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1792007 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6e0a5916b5
commit
3cbf4740b1
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
package org.apache.poi.xssf.eventusermodel;
|
package org.apache.poi.xssf.eventusermodel;
|
||||||
|
|
||||||
|
import static org.apache.poi.POITestCase.assertContains;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -181,9 +183,9 @@ public final class TestXSSFReader extends TestCase {
|
|||||||
XSSFReader.SheetIterator it = (XSSFReader.SheetIterator) r.getSheetsData();
|
XSSFReader.SheetIterator it = (XSSFReader.SheetIterator) r.getSheetsData();
|
||||||
|
|
||||||
String text = getShapesString(it);
|
String text = getShapesString(it);
|
||||||
assertTrue(text.contains("Line 1"));
|
assertContains(text, "Line 1");
|
||||||
assertTrue(text.contains("Line 2"));
|
assertContains(text, "Line 2");
|
||||||
assertTrue(text.contains("Line 3"));
|
assertContains(text, "Line 3");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getShapesString(XSSFReader.SheetIterator it) {
|
private String getShapesString(XSSFReader.SheetIterator it) {
|
||||||
@ -213,16 +215,16 @@ public final class TestXSSFReader extends TestCase {
|
|||||||
r = new XSSFReader(pkg);
|
r = new XSSFReader(pkg);
|
||||||
fail("This will fail until bug 57699 is fixed");
|
fail("This will fail until bug 57699 is fixed");
|
||||||
} catch (POIXMLException e) {
|
} catch (POIXMLException e) {
|
||||||
assertTrue("Had " + e, e.getMessage().contains("57699"));
|
assertContains(e.getMessage(), "57699");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
XSSFReader.SheetIterator it = (XSSFReader.SheetIterator) r.getSheetsData();
|
XSSFReader.SheetIterator it = (XSSFReader.SheetIterator) r.getSheetsData();
|
||||||
|
|
||||||
String text = getShapesString(it);
|
String text = getShapesString(it);
|
||||||
assertTrue(text.contains("Line 1"));
|
assertContains(text, "Line 1");
|
||||||
assertTrue(text.contains("Line 2"));
|
assertContains(text, "Line 2");
|
||||||
assertTrue(text.contains("Line 3"));
|
assertContains(text, "Line 3");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +19,7 @@ package org.apache.poi.hslf.extractor;
|
|||||||
|
|
||||||
import static org.apache.poi.POITestCase.assertContains;
|
import static org.apache.poi.POITestCase.assertContains;
|
||||||
import static org.apache.poi.POITestCase.assertContainsIgnoreCase;
|
import static org.apache.poi.POITestCase.assertContainsIgnoreCase;
|
||||||
|
import static org.apache.poi.POITestCase.assertNotContained;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
@ -160,7 +161,7 @@ public final class TestExtractor {
|
|||||||
assertEquals(nText.length(), 0);
|
assertEquals(nText.length(), 0);
|
||||||
|
|
||||||
// Slide records were fine
|
// Slide records were fine
|
||||||
assertTrue(text.startsWith("Using Disease Surveillance and Response"));
|
assertContains(text, "Using Disease Surveillance and Response");
|
||||||
|
|
||||||
ppe.close();
|
ppe.close();
|
||||||
}
|
}
|
||||||
@ -347,10 +348,10 @@ public final class TestExtractor {
|
|||||||
// Enable, shows up
|
// Enable, shows up
|
||||||
ppe1.setMasterByDefault(true);
|
ppe1.setMasterByDefault(true);
|
||||||
text = ppe1.getText();
|
text = ppe1.getText();
|
||||||
assertTrue(text.contains("Text that I added to the master slide"));
|
assertContains(text, "Text that I added to the master slide");
|
||||||
|
|
||||||
// Make sure placeholder text does not come out
|
// Make sure placeholder text does not come out
|
||||||
assertFalse(text.contains("Click to edit Master"));
|
assertNotContained(text, "Click to edit Master");
|
||||||
ppe1.close();
|
ppe1.close();
|
||||||
|
|
||||||
// Now with another file only containing master text
|
// Now with another file only containing master text
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package org.apache.poi.hwpf.extractor;
|
package org.apache.poi.hwpf.extractor;
|
||||||
|
|
||||||
import static org.apache.poi.POITestCase.assertContains;
|
import static org.apache.poi.POITestCase.assertContains;
|
||||||
|
import static org.apache.poi.POITestCase.assertStartsWith;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
@ -265,18 +266,18 @@ public final class TestWordExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWord95() throws Exception {
|
public void testWord95() throws Exception {
|
||||||
// Can work with the special one
|
// Can work with the special one
|
||||||
InputStream is = docTests.openResourceAsStream("Word95.doc");
|
InputStream is = docTests.openResourceAsStream("Word95.doc");
|
||||||
Word6Extractor w6e = new Word6Extractor(is);
|
Word6Extractor w6e = new Word6Extractor(is);
|
||||||
is.close();
|
is.close();
|
||||||
|
|
||||||
String text = w6e.getText();
|
String text = w6e.getText();
|
||||||
|
|
||||||
assertTrue(text.contains("The quick brown fox jumps over the lazy dog"));
|
assertContains(text, "The quick brown fox jumps over the lazy dog");
|
||||||
assertTrue(text.contains("Paragraph 2"));
|
assertContains(text, "Paragraph 2");
|
||||||
assertTrue(text.contains("Paragraph 3. Has some RED text and some BLUE BOLD text in it"));
|
assertContains(text, "Paragraph 3. Has some RED text and some BLUE BOLD text in it");
|
||||||
assertTrue(text.contains("Last (4th) paragraph"));
|
assertContains(text, "Last (4th) paragraph");
|
||||||
|
|
||||||
String[] tp = w6e.getParagraphText();
|
String[] tp = w6e.getParagraphText();
|
||||||
assertEquals(7, tp.length);
|
assertEquals(7, tp.length);
|
||||||
@ -288,8 +289,8 @@ public final class TestWordExtractor {
|
|||||||
assertEquals("\r\n", tp[5]);
|
assertEquals("\r\n", tp[5]);
|
||||||
assertEquals("Last (4th) paragraph.\r\n", tp[6]);
|
assertEquals("Last (4th) paragraph.\r\n", tp[6]);
|
||||||
w6e.close();
|
w6e.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=OldWordFileFormatException.class)
|
@Test(expected=OldWordFileFormatException.class)
|
||||||
public void testWord6_WordExtractor() throws IOException {
|
public void testWord6_WordExtractor() throws IOException {
|
||||||
// Too old for the default
|
// Too old for the default
|
||||||
@ -297,27 +298,27 @@ public final class TestWordExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWord6() throws Exception {
|
public void testWord6() throws Exception {
|
||||||
InputStream is = docTests.openResourceAsStream("Word6.doc");
|
InputStream is = docTests.openResourceAsStream("Word6.doc");
|
||||||
Word6Extractor w6e = new Word6Extractor(is);
|
Word6Extractor w6e = new Word6Extractor(is);
|
||||||
is.close();
|
is.close();
|
||||||
String text = w6e.getText();
|
String text = w6e.getText();
|
||||||
|
|
||||||
assertTrue(text.contains("The quick brown fox jumps over the lazy dog"));
|
assertContains(text, "The quick brown fox jumps over the lazy dog");
|
||||||
|
|
||||||
String[] tp = w6e.getParagraphText();
|
String[] tp = w6e.getParagraphText();
|
||||||
assertEquals(1, tp.length);
|
assertEquals(1, tp.length);
|
||||||
assertEquals("The quick brown fox jumps over the lazy dog\r\n", tp[0]);
|
assertEquals("The quick brown fox jumps over the lazy dog\r\n", tp[0]);
|
||||||
w6e.close();
|
w6e.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFastSaved() throws Exception {
|
public void testFastSaved() throws Exception {
|
||||||
WordExtractor extractor = openExtractor("rasp.doc");
|
WordExtractor extractor = openExtractor("rasp.doc");
|
||||||
|
|
||||||
String text = extractor.getText();
|
String text = extractor.getText();
|
||||||
assertTrue(text.contains("\u0425\u0425\u0425\u0425\u0425"));
|
assertContains(text, "\u0425\u0425\u0425\u0425\u0425");
|
||||||
assertTrue(text.contains("\u0423\u0423\u0423\u0423\u0423"));
|
assertContains(text, "\u0423\u0423\u0423\u0423\u0423");
|
||||||
|
|
||||||
extractor.close();
|
extractor.close();
|
||||||
}
|
}
|
||||||
@ -328,7 +329,7 @@ public final class TestWordExtractor {
|
|||||||
|
|
||||||
String text = extractor.getText();
|
String text = extractor.getText();
|
||||||
|
|
||||||
assertTrue(text.startsWith("\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435"));
|
assertStartsWith(text, "\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435");
|
||||||
extractor.close();
|
extractor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,10 @@
|
|||||||
|
|
||||||
package org.apache.poi.hwpf.usermodel;
|
package org.apache.poi.hwpf.usermodel;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.apache.poi.POITestCase.assertContains;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.apache.poi.hwpf.usermodel.CharacterRun;
|
import org.apache.poi.hwpf.usermodel.CharacterRun;
|
||||||
import org.apache.poi.hwpf.usermodel.Paragraph;
|
import org.apache.poi.hwpf.usermodel.Paragraph;
|
||||||
@ -25,22 +28,27 @@ import org.apache.poi.hwpf.usermodel.Range;
|
|||||||
import org.apache.poi.hwpf.HWPFDocument;
|
import org.apache.poi.hwpf.HWPFDocument;
|
||||||
import org.apache.poi.hwpf.HWPFTestDataSamples;
|
import org.apache.poi.hwpf.HWPFTestDataSamples;
|
||||||
|
|
||||||
public final class TestBug46610 extends TestCase {
|
public final class TestBug46610 {
|
||||||
|
|
||||||
public void testUtf() {
|
@Test
|
||||||
runExtract("Bug46610_1.doc");
|
public void testUtf() throws Exception {
|
||||||
|
String text = runExtract("Bug46610_1.doc");
|
||||||
|
assertNotNull(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUtf2() {
|
@Test
|
||||||
runExtract("Bug46610_2.doc");
|
public void testUtf2() throws Exception {
|
||||||
|
String text = runExtract("Bug46610_2.doc");
|
||||||
|
assertNotNull(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExtraction() {
|
@Test
|
||||||
|
public void testExtraction() throws Exception {
|
||||||
String text = runExtract("Bug46610_3.doc");
|
String text = runExtract("Bug46610_3.doc");
|
||||||
assertTrue(text.contains("\u0421\u0412\u041e\u042e"));
|
assertContains(text, "\u0421\u0412\u041e\u042e");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String runExtract(String sampleName) {
|
private static String runExtract(String sampleName) throws Exception {
|
||||||
HWPFDocument doc = HWPFTestDataSamples.openSampleFile(sampleName);
|
HWPFDocument doc = HWPFTestDataSamples.openSampleFile(sampleName);
|
||||||
StringBuffer out = new StringBuffer();
|
StringBuffer out = new StringBuffer();
|
||||||
|
|
||||||
@ -53,6 +61,7 @@ public final class TestBug46610 extends TestCase {
|
|||||||
CharacterRun characterRun = p.getCharacterRun(j);
|
CharacterRun characterRun = p.getCharacterRun(j);
|
||||||
characterRun.text();
|
characterRun.text();
|
||||||
}
|
}
|
||||||
|
doc.close();
|
||||||
}
|
}
|
||||||
return out.toString();
|
return out.toString();
|
||||||
}
|
}
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
package org.apache.poi.hwpf.usermodel;
|
package org.apache.poi.hwpf.usermodel;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.apache.poi.POITestCase.assertContains;
|
||||||
|
import static org.apache.poi.POITestCase.assertNotContained;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -300,9 +300,9 @@ public class TestBugs{
|
|||||||
{
|
{
|
||||||
String text = getText("Bug46817.doc").trim();
|
String text = getText("Bug46817.doc").trim();
|
||||||
|
|
||||||
assertTrue(text.contains("Nazwa wykonawcy"));
|
assertContains(text, "Nazwa wykonawcy");
|
||||||
assertTrue(text.contains("kujawsko-pomorskie"));
|
assertContains(text, "kujawsko-pomorskie");
|
||||||
assertTrue(text.contains("ekomel@ekomel.com.pl"));
|
assertContains(text, "ekomel@ekomel.com.pl");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -421,11 +421,11 @@ public class TestBugs{
|
|||||||
|
|
||||||
String docText = r.text();
|
String docText = r.text();
|
||||||
|
|
||||||
assertTrue(docText.contains("1-1"));
|
assertContains(docText, "1-1");
|
||||||
assertTrue(docText.contains("1-12"));
|
assertContains(docText, "1-12");
|
||||||
|
|
||||||
assertFalse(docText.contains("1-13"));
|
assertNotContained(docText, "1-13");
|
||||||
assertFalse(docText.contains("1-15"));
|
assertNotContained(docText, "1-15");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -437,8 +437,7 @@ public class TestBugs{
|
|||||||
{
|
{
|
||||||
String foundText = getText("Bug47731.doc");
|
String foundText = getText("Bug47731.doc");
|
||||||
|
|
||||||
assertTrue(foundText
|
assertContains(foundText, "Soak the rice in water for three to four hours");
|
||||||
.contains("Soak the rice in water for three to four hours"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -500,43 +499,25 @@ public class TestBugs{
|
|||||||
{
|
{
|
||||||
String text = getTextOldFile("Bug49933.doc");
|
String text = getTextOldFile("Bug49933.doc");
|
||||||
|
|
||||||
assertTrue( text.contains( "best.wine.jump.ru" ) );
|
assertContains(text, "best.wine.jump.ru");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bug 50936 - Exception parsing MS Word 8.0 file
|
* Bug 50936 - Exception parsing MS Word 8.0 file
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void test50936_1()
|
public void test50936() throws Exception
|
||||||
{
|
{
|
||||||
HWPFDocument hwpfDocument = HWPFTestDataSamples
|
String[] filenames = {"Bug50936_1.doc", "Bug50936_2.doc", "Bug50936_3.doc"};
|
||||||
.openSampleFile("Bug50936_1.doc");
|
for (String filename : filenames) {
|
||||||
hwpfDocument.getPicturesTable().getAllPictures();
|
HWPFDocument hwpfDocument = HWPFTestDataSamples.openSampleFile(filename);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
assertNotNull(filename, hwpfDocument.getPicturesTable().getAllPictures());
|
||||||
* Bug 50936 - Exception parsing MS Word 8.0 file
|
|
||||||
*/
|
hwpfDocument.close();
|
||||||
@Test
|
}
|
||||||
public void test50936_2()
|
|
||||||
{
|
|
||||||
HWPFDocument hwpfDocument = HWPFTestDataSamples
|
|
||||||
.openSampleFile("Bug50936_2.doc");
|
|
||||||
hwpfDocument.getPicturesTable().getAllPictures();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Bug 50936 - Exception parsing MS Word 8.0 file
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void test50936_3()
|
|
||||||
{
|
|
||||||
HWPFDocument hwpfDocument = HWPFTestDataSamples
|
|
||||||
.openSampleFile("Bug50936_3.doc");
|
|
||||||
hwpfDocument.getPicturesTable().getAllPictures();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [RESOLVED FIXED] Bug 51604 - replace text fails for doc (poi 3.8 beta
|
* [RESOLVED FIXED] Bug 51604 - replace text fails for doc (poi 3.8 beta
|
||||||
* release from download site )
|
* release from download site )
|
||||||
|
@ -20,6 +20,8 @@ package org.apache.poi.hssf.extractor;
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.apache.poi.POITestCase.assertContains;
|
||||||
|
import static org.apache.poi.POITestCase.assertStartsWith;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -105,8 +107,6 @@ public final class TestExcelExtractor {
|
|||||||
|
|
||||||
ExcelExtractor extractor = createExtractor("StringContinueRecords.xls");
|
ExcelExtractor extractor = createExtractor("StringContinueRecords.xls");
|
||||||
|
|
||||||
extractor.getText();
|
|
||||||
|
|
||||||
// Has masses of text
|
// Has masses of text
|
||||||
// Until we fixed bug #41064, this would've
|
// Until we fixed bug #41064, this would've
|
||||||
// failed by now
|
// failed by now
|
||||||
@ -231,19 +231,19 @@ public final class TestExcelExtractor {
|
|||||||
extractor.setIncludeBlankCells(true);
|
extractor.setIncludeBlankCells(true);
|
||||||
String padded = extractor.getText();
|
String padded = extractor.getText();
|
||||||
|
|
||||||
assertTrue(def.startsWith(
|
assertStartsWith(def,
|
||||||
"Sheet1\n" +
|
"Sheet1\n" +
|
||||||
"&[TAB]\t\n" +
|
"&[TAB]\t\n" +
|
||||||
"Hello\n" +
|
"Hello\n" +
|
||||||
"11\t23\n"
|
"11\t23\n"
|
||||||
));
|
);
|
||||||
|
|
||||||
assertTrue(padded.startsWith(
|
assertStartsWith(padded,
|
||||||
"Sheet1\n" +
|
"Sheet1\n" +
|
||||||
"&[TAB]\t\n" +
|
"&[TAB]\t\n" +
|
||||||
"Hello\n" +
|
"Hello\n" +
|
||||||
"11\t\t\t23\n"
|
"11\t\t\t23\n"
|
||||||
));
|
);
|
||||||
|
|
||||||
extractor.close();
|
extractor.close();
|
||||||
}
|
}
|
||||||
@ -262,17 +262,14 @@ public final class TestExcelExtractor {
|
|||||||
// actually quite match what they claim to
|
// actually quite match what they claim to
|
||||||
// be, as some are auto-local builtins...
|
// be, as some are auto-local builtins...
|
||||||
|
|
||||||
assertTrue(text.startsWith(
|
assertStartsWith(text, "Dates, all 24th November 2006\n");
|
||||||
"Dates, all 24th November 2006\n"
|
assertContains(text, "yyyy/mm/dd\t2006/11/24\n");
|
||||||
));
|
assertContains(text, "yyyy-mm-dd\t2006-11-24\n");
|
||||||
assertTrue(text.contains("yyyy/mm/dd\t2006/11/24\n"));
|
assertContains(text, "dd-mm-yy\t24-11-06\n");
|
||||||
assertTrue(text.contains("yyyy-mm-dd\t2006-11-24\n"));
|
|
||||||
assertTrue(text.contains("dd-mm-yy\t24-11-06\n"));
|
|
||||||
|
|
||||||
assertTrue("Had: " + text + ", but should contain 'nn.nn\\t10.52\\n'",
|
assertContains(text, "nn.nn\t10.52\n");
|
||||||
text.contains("nn.nn\t10.52\n"));
|
assertContains(text, "nn.nnn\t10.520\n");
|
||||||
assertTrue(text.contains("nn.nnn\t10.520\n"));
|
assertContains(text, "\u00a3nn.nn\t\u00a310.52\n");
|
||||||
assertTrue(text.contains("\u00a3nn.nn\t\u00a310.52\n"));
|
|
||||||
extractor.close();
|
extractor.close();
|
||||||
} finally {
|
} finally {
|
||||||
LocaleUtil.setUserLocale(userLocale);
|
LocaleUtil.setUserLocale(userLocale);
|
||||||
@ -367,8 +364,8 @@ public final class TestExcelExtractor {
|
|||||||
for (String file : files) {
|
for (String file : files) {
|
||||||
ExcelExtractor extractor = createExtractor(file);
|
ExcelExtractor extractor = createExtractor(file);
|
||||||
String text = extractor.getText();
|
String text = extractor.getText();
|
||||||
assertTrue("Unable to find expected word in text\n" + text, text.contains("testdoc"));
|
assertContains(file, text, "testdoc");
|
||||||
assertTrue("Unable to find expected word in text\n" + text, text.contains("test phrase"));
|
assertContains(file, text, "test phrase");
|
||||||
extractor.close();
|
extractor.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -380,7 +377,7 @@ public final class TestExcelExtractor {
|
|||||||
String text = extractor.getText();
|
String text = extractor.getText();
|
||||||
Biff8EncryptionKey.setCurrentUserPassword(null);
|
Biff8EncryptionKey.setCurrentUserPassword(null);
|
||||||
|
|
||||||
assertTrue(text.contains("ZIP"));
|
assertContains(text, "ZIP");
|
||||||
extractor.close();
|
extractor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,10 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
|
import static org.junit.Assert.assertSame;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
import static org.apache.poi.POITestCase.assertContains;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
@ -999,6 +1001,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
|
|||||||
// Check that asking for the same font
|
// Check that asking for the same font
|
||||||
// multiple times gives you the same thing.
|
// multiple times gives you the same thing.
|
||||||
// Otherwise, our tests wouldn't work!
|
// Otherwise, our tests wouldn't work!
|
||||||
|
assertSame(wb.getFontAt((short)0), wb.getFontAt((short)0));
|
||||||
assertEquals(
|
assertEquals(
|
||||||
wb.getFontAt((short)0),
|
wb.getFontAt((short)0),
|
||||||
wb.getFontAt((short)0)
|
wb.getFontAt((short)0)
|
||||||
@ -2354,10 +2357,10 @@ public final class TestBugs extends BaseTestBugzillaIssues {
|
|||||||
// Extract and check
|
// Extract and check
|
||||||
ExcelExtractor ex = new ExcelExtractor(wb);
|
ExcelExtractor ex = new ExcelExtractor(wb);
|
||||||
String text = ex.getText();
|
String text = ex.getText();
|
||||||
assertTrue(text.contains("Top Left Cell"));
|
assertContains(text, "Top Left Cell");
|
||||||
assertTrue(text.contains("Top Right Cell"));
|
assertContains(text, "Top Right Cell");
|
||||||
assertTrue(text.contains("Bottom Left Cell"));
|
assertContains(text, "Bottom Left Cell");
|
||||||
assertTrue(text.contains("Bottom Right Cell"));
|
assertContains(text, "Bottom Right Cell");
|
||||||
ex.close();
|
ex.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2467,8 +2470,8 @@ public final class TestBugs extends BaseTestBugzillaIssues {
|
|||||||
list.add(r.getSid());
|
list.add(r.getSid());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
assertTrue(list.get(list.size()-1).intValue() == UnknownRecord.BITMAP_00E9);
|
assertEquals(UnknownRecord.BITMAP_00E9, list.get(list.size()-1).intValue());
|
||||||
assertTrue(list.get(list.size()-2).intValue() == UnknownRecord.HEADER_FOOTER_089C);
|
assertEquals(UnknownRecord.HEADER_FOOTER_089C, list.get(list.size()-2).intValue());
|
||||||
wb.close();
|
wb.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user