import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
*
* This is part 1 of 2 of the tests - it only does the POIDocuments
* which are part of the Main (not scratchpad)
- *
- * @author Nick Burch (nick at torchbox dot com)
*/
-public final class TestPOIDocumentMain extends TestCase {
+public final class TestPOIDocumentMain {
// The POI Documents to work on
private POIDocument doc;
private POIDocument doc2;
/**
* Set things up, two spreadsheets for our testing
*/
- public void setUp() {
+ @Before
+ public void setUp() {
doc = HSSFTestDataSamples.openSampleWorkbook("DateFormats.xls");
doc2 = HSSFTestDataSamples.openSampleWorkbook("StringFormulas.xls");
}
- public void testReadProperties() {
+ @Test
+ public void readProperties() {
// We should have both sets
assertNotNull(doc.getDocumentSummaryInformation());
assertNotNull(doc.getSummaryInformation());
assertEquals(0, doc.getDocumentSummaryInformation().getByteCount());
}
- public void testReadProperties2() {
+ @Test
+ public void readProperties2() {
// Check again on the word one
assertNotNull(doc2.getDocumentSummaryInformation());
assertNotNull(doc2.getSummaryInformation());
assertEquals(0, doc2.getDocumentSummaryInformation().getByteCount());
}
- public void testWriteProperties() throws Exception {
+ @Test
+ public void writeProperties() throws Exception {
// Just check we can write them back out into a filesystem
NPOIFSFileSystem outFS = new NPOIFSFileSystem();
doc.readProperties();
);
}
- public void testWriteReadProperties() throws Exception {
+ @Test
+ public void WriteReadProperties() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// Write them out
doc.readProperties();
// Delegate test
- testReadProperties();
+ readProperties();
}
- public void testCreateNewProperties() throws IOException {
+ @Test
+ public void createNewProperties() throws IOException {
POIDocument doc = new HSSFWorkbook();
// New document won't have them
assertNotNull(doc.getDocumentSummaryInformation());
}
- public void testCreateNewPropertiesOnExistingFile() throws IOException {
+ @Test
+ public void createNewPropertiesOnExistingFile() throws IOException {
POIDocument doc = new HSSFWorkbook();
// New document won't have them