From bbea24077589b64bb9a2c6434a4d46a9bd590754 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Tue, 26 Dec 2023 18:46:30 +0100 Subject: [PATCH] Add a few more tests --- .../poitest/ApplicationTest.java | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/poitest/src/androidTest/java/org/dstadler/poiandroidtest/poitest/ApplicationTest.java b/poitest/src/androidTest/java/org/dstadler/poiandroidtest/poitest/ApplicationTest.java index 2daa82f5..eb865466 100644 --- a/poitest/src/androidTest/java/org/dstadler/poiandroidtest/poitest/ApplicationTest.java +++ b/poitest/src/androidTest/java/org/dstadler/poiandroidtest/poitest/ApplicationTest.java @@ -1,14 +1,21 @@ package org.dstadler.poiandroidtest.poitest; +import org.apache.commons.io.output.NullOutputStream; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.apache.poi.ooxml.POIXMLDocumentPart; import org.dstadler.poiandroidtest.poitest.dummy.DummyContent; +import org.dstadler.poiandroidtest.poitest.test.TestIssue28; +import org.dstadler.poiandroidtest.poitest.test.TestIssue84; +import org.dstadler.poiandroidtest.poitest.test.TestIssue89; import org.junit.Test; import org.junit.runner.RunWith; +import java.io.IOException; + import androidx.test.ext.junit.runners.AndroidJUnit4; +import static org.junit.Assert.fail; + /** * Testing Fundamentals */ @@ -21,4 +28,34 @@ public void test() { // just some very simple things to verify that testing works basically DummyContent.addItem(new DummyContent.DummyItem("1", "bla", "some text")); } + + @Test + public void testLog() { + LOG.info("Testing..."); + } + + @Test + public void test28() throws IOException { + TestIssue28.saveExcelFile(NullOutputStream.INSTANCE); + } + + @Test + public void test84() throws IOException { + try { + TestIssue84.saveExcelFile(NullOutputStream.INSTANCE); + fail("Usually throws an exception because there are missing AWT classes"); + } catch (NoClassDefFoundError e) { + // expected here + } + } + + @Test + public void test89() { + try { + TestIssue89.saveExcelFile(NullOutputStream.INSTANCE); + fail("Usually throws an exception because there are missing AWT classes"); + } catch (NoClassDefFoundError e) { + // expected here + } + } }