/**
   * Cleans up after the tests.
   *
   * @throws SienaException
   */
  @After
  public void cleanUp() throws SienaException {

    employment1.remove();

    employment2.remove();

    contract.remove();

    course.remove();

    assistant.remove();

    financialCategory.remove();

    File file = new File("Test_Report.pdf");
    file.delete();
  }
  /**
   * Prepares this test.
   *
   * @throws SienaException
   */
  @BeforeClass
  public static void beforeClassSetUp() throws SienaException {
    de.aidger.model.Runtime.getInstance().initialize();

    String autoOpen = Runtime.getInstance().getOption("auto-open");
    if (autoOpen.equals("true")) {
      openSetting = true;
    }
    Runtime.getInstance().setOption("auto-open", "false");

    financialCategory = new FinancialCategory();
    financialCategory.setBudgetCosts(new Integer[] {1000});
    financialCategory.setCostUnits(new Integer[] {10000000});
    financialCategory.setName("Test Category");
    financialCategory.setYear((short) 2010);
    financialCategory.save();

    course = new Course();
    course.setAdvisor("Tester");
    course.setDescription("Description");
    course.setFinancialCategoryId(financialCategory.getId());
    course.setGroup("2");
    course.setLecturer("Test Tester");
    course.setNumberOfGroups(3);
    course.setPart('a');
    course.setRemark("Remark");
    course.setScope("Sniper Scope");
    course.setSemester("SS09");
    course.setTargetAudience("Testers");
    course.setUnqualifiedWorkingHours(100.0);
    course.save();

    assistant = new Assistant();
    assistant.setEmail("*****@*****.**");
    assistant.setFirstName("Test");
    assistant.setLastName("Tester");
    assistant.setQualification("g");
    assistant.save();

    contract = new Contract();
    contract.setStartDate(new Date(1970, 1, 1));
    contract.setCompletionDate(new Date(1970, 1, 2));
    contract.setConfirmationDate(new Date(1970, 1, 3));
    contract.setEndDate(new Date(1970, 1, 4));
    contract.setDelegation(true);
    contract.setType("Test type");
    contract.setAssistantId(assistant.getId());
    contract.save();

    employment1 = new Employment();
    employment1.setAssistantId(assistant.getId());
    employment1.setCourseId(course.getId());
    employment1.setCostUnit(1);
    employment1.setHourCount(10.0);
    employment1.setContractId(contract.getId());
    employment1.setFunds("Test unit");
    employment1.setMonth((byte) 1);
    employment1.setQualification("g");
    employment1.setRemark("Test remark");
    employment1.setYear((short) 1970);
    employment1.save();

    employment2 = new Employment();
    employment2.setAssistantId(assistant.getId());
    employment2.setCourseId(course.getId());
    employment2.setCostUnit(2);
    employment2.setHourCount(10.0);
    employment2.setContractId(contract.getId());
    employment2.setFunds("Test unit");
    employment2.setMonth((byte) 1);
    employment2.setQualification("g");
    employment2.setRemark("Test remark");
    employment2.setYear((short) 1970);
    employment2.save();
  }