@Test
 public void testTemplate() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   massImportForm.setTemplate(template);
   assertEquals(template, massImportForm.getTemplate());
 }
 @Test
 public void testGetDocstructssize() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   massImportForm.setTemplate(template);
   massImportForm.setCurrentPlugin("JunitImportPluginWithSecondPage");
   assertEquals(1, massImportForm.getDocstructssize());
 }
 @Test
 public void testGetCurrentPlugin() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   massImportForm.setTemplate(template);
   massImportForm.setCurrentPlugin("JunitImportPlugin");
   assertEquals("JunitImportPlugin", massImportForm.getCurrentPlugin());
 }
 @Test
 public void testGetProperties() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   massImportForm.setTemplate(template);
   massImportForm.setCurrentPlugin("JunitImportPluginWithProperties");
   List<ImportProperty> fixture = massImportForm.getProperties();
   assertEquals(1, fixture.size());
 }
 @SuppressWarnings("deprecation")
 @Test
 public void testGetInclude() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   massImportForm.setTemplate(template);
   massImportForm.setCurrentPlugin("JunitImportPlugin");
   assertEquals("plugins/JunitImportPlugin.jsp", massImportForm.getInclude());
 }
 @Test
 public void testPrepare() throws Exception {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   massImportForm.setTemplate(template);
   assertEquals("", massImportForm.Prepare());
   secondStep.setBenutzer(userList);
   assertEquals("process_import_1", massImportForm.Prepare());
 }
  @Test
  public void testUploadedFile() throws FileNotFoundException {
    InputStream stream = new FileInputStream("/opt/digiverso/junit/data/metadata.xml");
    Part file = new MockUploadedFile(stream, "junit");
    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);

    massImportForm.setUploadedFile(file);
    assertEquals(file, massImportForm.getUploadedFile());
  }
  @Test
  public void testProcessList() {
    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);

    List<Process> processList = new ArrayList<>();
    processList.add(template);
    massImportForm.setProcessList(processList);
    assertEquals(processList, massImportForm.getProcessList());
  }
  @Test
  public void testConvertWithFileRecord() throws FileNotFoundException {

    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);
    massImportForm.setRecords("junit");

    massImportForm.setCurrentPlugin("JunitImportPlugin");
    String fixture = massImportForm.convertData();
    assertEquals("process_import_3", fixture);
  }
 @Test
 public void testConvertWithFileUpload() throws FileNotFoundException {
   InputStream stream = new FileInputStream("/opt/digiverso/junit/data/metadata.xml");
   Part file = new MockUploadedFile(stream, "./some/path\\junit.xml");
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   massImportForm.setTemplate(template);
   massImportForm.setUploadedFile(file);
   massImportForm.uploadFile();
   massImportForm.setCurrentPlugin("JunitImportPlugin");
   String fixture = massImportForm.convertData();
   assertEquals("process_import_3", fixture);
 }
  @Test
  public void testGetDocstructs() {
    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);
    massImportForm.setCurrentPlugin("JunitImportPlugin");
    List<? extends DocstructElement> fixture = massImportForm.getDocstructs();
    assertEquals(0, fixture.size());

    massImportForm.setCurrentPlugin("JunitImportPluginWithSecondPage");
    fixture = massImportForm.getDocstructs();
    assertEquals(1, fixture.size());
  }
  @Test
  public void testConvertFail() throws FileNotFoundException {

    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);
    List<String> list = new ArrayList<>();
    list.add("junit");
    massImportForm.setSelectedFilenames(list);

    massImportForm.setCurrentPlugin("JunitImportPluginError");
    String fixture = massImportForm.convertData();
    assertEquals("", fixture);
  }
  @Test
  public void testUploadFile() throws FileNotFoundException {
    InputStream stream = new FileInputStream("/opt/digiverso/junit/data/metadata.xml");
    Part file = new MockUploadedFile(stream, "./some/path\\junit.xml");
    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);

    massImportForm.setUploadedFile(file);
    massImportForm.uploadFile();

    Path dest = Paths.get(ConfigurationHelper.getInstance().getTemporaryFolder(), "junit.xml");
    assertTrue(Files.exists(dest) && Files.isRegularFile(dest));
  }
  @Test
  public void testGetNextPage() {
    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);
    massImportForm.setCurrentPlugin("JunitImportPlugin");
    String fixture = massImportForm.nextPage();
    assertEquals("", fixture);

    massImportForm.setIdList("junit");
    fixture = massImportForm.nextPage();
    assertEquals("process_import_2", fixture);

    massImportForm.setCurrentPlugin("JunitImportPluginWithSecondPage");
    fixture = massImportForm.nextPage();
    assertEquals("process_import_2_mass", fixture);
  }
  @Test
  public void testGetHasNextPage() {
    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);
    massImportForm.setCurrentPlugin("JunitImportPlugin");
    boolean fixture = massImportForm.getHasNextPage();
    assertFalse(fixture);

    massImportForm.setCurrentPlugin("JunitImportPluginWithSecondPage");
    fixture = massImportForm.getHasNextPage();
    assertTrue(fixture);

    massImportForm.setCurrentPlugin("JunitImportPluginWithProperties");
    fixture = massImportForm.getHasNextPage();
    assertTrue(fixture);
  }