diff --git a/appointment-import/src/main/java/smash/appointment/parse/SubjectParser.java b/appointment-import/src/main/java/smash/appointment/parse/SubjectParser.java index d3fe996ccf5ce42c1510aa754bee26c303670612..3a0ac4a8fe3aa188aa96e1e2a722cea8d20e55db 100644 --- a/appointment-import/src/main/java/smash/appointment/parse/SubjectParser.java +++ b/appointment-import/src/main/java/smash/appointment/parse/SubjectParser.java @@ -142,6 +142,9 @@ public abstract class SubjectParser { } protected String getDate(Cell cell) { + if (cell == null) { + return ""; + } String result = null; if (cell.getCellTypeEnum().equals(CellType.STRING)) { result = getString(cell); diff --git a/appointment-import/src/test/java/smash/appointment/parse/AllTests.java b/appointment-import/src/test/java/smash/appointment/parse/AllTests.java index d51943e606144e2f258b0d5f08f87f823fc47bff..5aaea5c96f9646e676ea97f75dc921964bac8042 100644 --- a/appointment-import/src/test/java/smash/appointment/parse/AllTests.java +++ b/appointment-import/src/test/java/smash/appointment/parse/AllTests.java @@ -11,6 +11,7 @@ import org.junit.runners.Suite.SuiteClasses; RedcapParserTest.class, // SubjectDaoTest.class, // + SubjectParserTest.class, // XlsxCalendarProcessorTest.class, // }) public class AllTests { diff --git a/appointment-import/src/test/java/smash/appointment/parse/SubjectParserTest.java b/appointment-import/src/test/java/smash/appointment/parse/SubjectParserTest.java new file mode 100644 index 0000000000000000000000000000000000000000..fffb1641f6670824c3014da3d5e72f65a7ed39e7 --- /dev/null +++ b/appointment-import/src/test/java/smash/appointment/parse/SubjectParserTest.java @@ -0,0 +1,30 @@ +package smash.appointment.parse; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; + +public class SubjectParserTest { + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testParseDate() { + SubjectParser parser = new PrcControlParser(); + assertEquals("", parser.getDate(null)); + } + +}