@Test
  public void exceptionHandlingRequiredFilesMissing() throws Exception {
    TakstParser takstParser = new TakstParser();
    File dir = FileUtils.toFile(getClass().getClassLoader().getResource("data/incomplete/"));

    try {
      takstParser.parseFiles(dir.listFiles());
      fail("expected the parser to complain about missing file");
    } catch (ParserException e) {
      assertTrue(e.getMessage().contains("lms28.txt")); // the missing file
    }
  }
  @Test
  public void exceptionHandlingUnparsable() throws Exception {
    TakstParser takstParser = new TakstParser();
    File dir = FileUtils.toFile(getClass().getClassLoader().getResource("data/unparsable/"));

    try {
      takstParser.parseFiles(dir.listFiles());
      fail("expected the parser to complain about missing file");
    } catch (ParserException e) {
      assertTrue(e.getMessage().contains("8100009555S")); // the offending value
      assertTrue(e.getMessage().contains("Laegemiddel")); // the name of the entity involved
    }
  }
  @Test
  public void getDateFromLineTest() throws Exception {
    TakstParser takstParser = new TakstParser();

    Date date =
        takstParser.getValidFromDate(
            "0012.0 LMS-TAKST                               20090713                0131LMS.ZIP     200929");

    DateTime parsedDate = new DateTime(date);

    assertEquals(2009, parsedDate.getYear());
    assertEquals(7, parsedDate.getMonthOfYear());
    assertEquals(13, parsedDate.getDayOfMonth());
  }