Fix inconsistent indents

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1676845 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2015-04-29 20:13:42 +00:00
parent 2889cabaed
commit 73aa2c9ee3

View File

@ -31,103 +31,103 @@ import org.apache.poi.openxml4j.opc.OPCPackage;
import junit.framework.TestCase;
public final class TestWorkbookFactory extends TestCase {
private String xls;
private String xlsx;
private String xls;
private String xlsx;
private String[] xls_prot;
private String[] xlsx_prot;
private String txt;
private String txt;
protected void setUp() {
xls = "SampleSS.xls";
xlsx = "SampleSS.xlsx";
xls_prot = new String[] {"password.xls", "password"};
xlsx_prot = new String[]{"protected_passtika.xlsx", "tika"};
txt = "SampleSS.txt";
}
protected void setUp() {
xls = "SampleSS.xls";
xlsx = "SampleSS.xlsx";
xls_prot = new String[] {"password.xls", "password"};
xlsx_prot = new String[]{"protected_passtika.xlsx", "tika"};
txt = "SampleSS.txt";
}
public void testCreateNative() throws Exception {
Workbook wb;
public void testCreateNative() throws Exception {
Workbook wb;
// POIFS -> hssf
wb = WorkbookFactory.create(
new POIFSFileSystem(HSSFTestDataSamples.openSampleFileStream(xls))
);
assertNotNull(wb);
assertTrue(wb instanceof HSSFWorkbook);
wb.close();
// POIFS -> hssf
wb = WorkbookFactory.create(
new POIFSFileSystem(HSSFTestDataSamples.openSampleFileStream(xls))
);
assertNotNull(wb);
assertTrue(wb instanceof HSSFWorkbook);
wb.close();
// Package -> xssf
wb = WorkbookFactory.create(
OPCPackage.open(
// Package -> xssf
wb = WorkbookFactory.create(
OPCPackage.open(
HSSFTestDataSamples.openSampleFileStream(xlsx))
);
assertNotNull(wb);
assertTrue(wb instanceof XSSFWorkbook);
// TODO: this re-writes the sample-file?! wb.close();
}
);
assertNotNull(wb);
assertTrue(wb instanceof XSSFWorkbook);
// TODO: this re-writes the sample-file?! wb.close();
}
/**
* Creates the appropriate kind of Workbook, but
* checking the mime magic at the start of the
* InputStream, then creating what's required.
*/
public void testCreateGeneric() throws Exception {
Workbook wb;
/**
* Creates the appropriate kind of Workbook, but
* checking the mime magic at the start of the
* InputStream, then creating what's required.
*/
public void testCreateGeneric() throws Exception {
Workbook wb;
// InputStream -> either
wb = WorkbookFactory.create(
HSSFTestDataSamples.openSampleFileStream(xls)
);
assertNotNull(wb);
assertTrue(wb instanceof HSSFWorkbook);
wb.close();
// InputStream -> either
wb = WorkbookFactory.create(
HSSFTestDataSamples.openSampleFileStream(xls)
);
assertNotNull(wb);
assertTrue(wb instanceof HSSFWorkbook);
wb.close();
wb = WorkbookFactory.create(
HSSFTestDataSamples.openSampleFileStream(xlsx)
);
assertNotNull(wb);
assertTrue(wb instanceof XSSFWorkbook);
// TODO: this re-writes the sample-file?! wb.close();
wb = WorkbookFactory.create(
HSSFTestDataSamples.openSampleFileStream(xlsx)
);
assertNotNull(wb);
assertTrue(wb instanceof XSSFWorkbook);
// TODO: this re-writes the sample-file?! wb.close();
// File -> either
wb = WorkbookFactory.create(
HSSFTestDataSamples.getSampleFile(xls)
);
assertNotNull(wb);
assertTrue(wb instanceof HSSFWorkbook);
wb.close();
// File -> either
wb = WorkbookFactory.create(
HSSFTestDataSamples.getSampleFile(xls)
);
assertNotNull(wb);
assertTrue(wb instanceof HSSFWorkbook);
wb.close();
wb = WorkbookFactory.create(
HSSFTestDataSamples.getSampleFile(xlsx)
);
assertNotNull(wb);
assertTrue(wb instanceof XSSFWorkbook);
wb = WorkbookFactory.create(
HSSFTestDataSamples.getSampleFile(xlsx)
);
assertNotNull(wb);
assertTrue(wb instanceof XSSFWorkbook);
// TODO: close() re-writes the sample-file?! Resort to revert() for now to close file handle...
((XSSFWorkbook)wb).getPackage().revert();
// TODO: close() re-writes the sample-file?! Resort to revert() for now to close file handle...
((XSSFWorkbook)wb).getPackage().revert();
// Invalid type -> exception
try {
InputStream stream = HSSFTestDataSamples.openSampleFileStream(txt);
try {
// Invalid type -> exception
try {
InputStream stream = HSSFTestDataSamples.openSampleFileStream(txt);
try {
wb = WorkbookFactory.create(stream);
} finally {
stream.close();
}
fail();
} catch(IllegalArgumentException e) {
// Good
}
}
} finally {
stream.close();
}
fail();
} catch(IllegalArgumentException e) {
// Good
}
}
/**
* Check that the overloaded stream methods which take passwords work properly
*/
public void testCreateWithPasswordFromStream() throws Exception {
/**
* Check that the overloaded stream methods which take passwords work properly
*/
public void testCreateWithPasswordFromStream() throws Exception {
Workbook wb;
// Unprotected, no password given, opens normally
// Unprotected, no password given, opens normally
wb = WorkbookFactory.create(
HSSFTestDataSamples.openSampleFileStream(xls), null
);
@ -186,7 +186,7 @@ public final class TestWorkbookFactory extends TestCase {
);
fail("Shouldn't be able to open with the wrong password");
} catch (EncryptedDocumentException e) {}
}
}
/**
* Check that the overloaded file methods which take passwords work properly