Package de.berndsteindorff.junittca.model

Examples of de.berndsteindorff.junittca.model.Project


   */
  @Test
  public void runTests() throws Exception {
    logger.info("runTests");
    ph.newProject("bla");
    Project project = ph.getProject();
    project.setClasspath(CLASSPATH);
    project.addTestClass(new ClassFile(NAME_DUMMYTEST, CLASSPATH + DIRSEP));
    project.setName("bla17");
    ph.runTests();

    assertEquals(1, project.getTestRuns().size());
    ph.closeDatabase();
    ph.loadFile(new File(PATH_DB + i + ".yap"));
    ph.loadProject("bla17");
    project = ph.getProject();
    assertEquals(1, project.getTestRuns().size());
  }
View Full Code Here


   *
   * @throws ClassNotFoundException
   */
  @Test
  public void equalsAfterRun() throws ClassNotFoundException {
    Project project = new Project("bla");
    project.addTestClass(new ClassFile(Const.NAME_DUMMYTEST,
        Const.CLASSPATH + Const.DIRSEP));
    project.runTests();
    cm.equals(cm);

    assertEquals(cm, project.getTestRuns().get(0).getClassMethods().get(0));
  }
View Full Code Here

   */
  @Test
  public void classMethodsMethodExtractingSimple()
      throws ClassNotFoundException {
    logger.info("constructorAndMethodExtracting");
    Project project = new Project("Bla");
    project.addTestClass(new ClassFile(NAME_DUMMYTEST, CLASSPATH + DIRSEP));
    project.runTests();

    assertEquals(1, project.getTestRuns().size());
    assertEquals(1, project.getTestRuns().get(0).getClassMethods().size());

    ClassMethods classMethods = project.getTestRuns().get(0)
        .getClassMethods().get(0);
    assertEquals(NAME_DUMMYTEST, classMethods.getClassName());
    assertEquals(3, classMethods.getTestMethods().size());
    assertEquals(2, classMethods.getIgnoredTestMethods().size());
  }
View Full Code Here

   */
  @Test
  public void classMethodsMethodExtractingSort()
      throws ClassNotFoundException {
    logger.info("constructorAndMethodExtracting");
    Project project = new Project("Bla");
    project.addTestClass(new ClassFile(NAME_DUMMYTEST, CLASSPATH + DIRSEP));
    project.runTests();

    assertEquals(1, project.getTestRuns().size());
    assertEquals(1, project.getTestRuns().get(0).getClassMethods().size());

    ClassMethods classMethods = project.getTestRuns().get(0)
        .getClassMethods().get(0);
    assertEquals(NAME_DUMMYTEST, classMethods.getClassName());
    assertEquals("dummyTest", classMethods.getTestMethods().get(0));
    assertEquals("gDummyTest", classMethods.getTestMethods().get(1));
    assertEquals("zDummyTest", classMethods.getTestMethods().get(2));
View Full Code Here

   * Test sorting project-classes when insert it into the project..
   */
  @Test
  public void sortedTestClasses() {
    logger.info("sortedTestClasses");
    Project project = new Project("Bla");
    project.addTestClass(new ClassFile(
        "de.berndsteindorff.junittca.model.test.ProjectTest", CLASSPATH
            + DIRSEP));
    project.addTestClass(new ClassFile(NAME_DUMMYTEST, CLASSPATH + DIRSEP));
    project.addTestClass(new ClassFile(
        "de.berndsteindorff.junittca.model.test.RunTest", CLASSPATH
            + DIRSEP));

    List<ClassFile> exp = new ArrayList<ClassFile>(3);
    exp.add(new ClassFile(NAME_DUMMYTEST, CLASSPATH + DIRSEP));
    exp.add(new ClassFile(
        "de.berndsteindorff.junittca.model.test.ProjectTest", CLASSPATH
            + DIRSEP));
    exp.add(new ClassFile("de.berndsteindorff.junittca.model.test.RunTest",
        CLASSPATH + DIRSEP));

    List<ClassFile> done = project.getActualTestClasses();
    assertArrayEquals(exp.toArray(new ClassFile[0]), done
        .toArray(new ClassFile[0]));
  }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void unmodicableGetter() throws Exception {
    logger.info("unmodicableGetter");
    Project project = new Project("Bla");
    project.setClasspath(CLASSPATH);
    project.addTestClass(new ClassFile(NAME_DUMMYTEST, CLASSPATH + DIRSEP));

    List<ClassFile> classes = project.getActualTestClasses();
    try {
      classes.add(new ClassFile(
          "de.berndsteindorff.junittca.model.test.ProjectTest",
          CLASSPATH + DIRSEP));
      System.out.println("bla");
      fail("Es konnte die Liste der Test-Klassen doch verändert werden");
    } catch (UnsupportedOperationException e) {
      assertEquals(UnsupportedOperationException.class, e.getClass());
    }

    project.runTests();

    List<Run> runs = project.getTestRuns();

    Result result = JUnitCore.runClasses(DummyTest.class);
    ArrayList<String> testMethods = new ArrayList<String>(3);
    testMethods.add("zDummyTest");
    testMethods.add("dummyTest");
View Full Code Here

   * Test if a class could be inserted more than once in a project.
   */
  @Test
  public void addClassMultiple() {
    logger.info("addClassMultiple");
    Project project = new Project("Bla");
    project.addTestClass(new ClassFile(NAME_DUMMYTEST, CLASSPATH + DIRSEP));
    project.addTestClass(new ClassFile(NAME_DUMMYTEST, CLASSPATH + DIRSEP));
    project.addTestClass(new ClassFile(NAME_DUMMYTEST, CLASSPATH + DIRSEP));

    assertEquals(1, project.getActualTestClasses().size());
  }
View Full Code Here

   *             Should not happen.
   */
  @Test
  public void addRunAtBeginOfList() throws Exception {
    logger.info("addRunAtBeginOfList");
    Project project = new Project("Bla");
    project.setClasspath(Const.CLASSPATH);
    project.addTestClass(new ClassFile(NAME_DUMMYTEST, CLASSPATH + DIRSEP));

    // 1. Testlauf
    // logger.info("1. Testlauf");
    project.runTests();
    assertEquals(1, project.getTestRuns().size());
    Run run1 = project.getTestRuns().get(0);
    Date date1 = run1.getRunDate();

    // 2. Testlauf
    // logger.info("2. Testlauf");
    project.runTests();
    assertEquals(2, project.getTestRuns().size());
    Run run2 = project.getTestRuns().get(0);
    Date date2 = run2.getRunDate();
    // logger.info("date1: " + date1 + date1.getTime());
    // logger.info("date2: " + date2 + date2.getTime());
    assertEquals(true, date2.after(date1));

    // 3. Testlauf
    // logger.info("3. Testlauf");
    project.runTests();
    assertEquals(3, project.getTestRuns().size());
    Run run3 = project.getTestRuns().get(0);
    Date date3 = run3.getRunDate();
    // logger.info("date1: " + date1 + date1.getTime());
    // logger.info("date2: " + date2 + date2.getTime());
    // logger.info("date3: " + date3 + date3.getTime());
    assertEquals(true, date3.after(date1));
View Full Code Here

   * another format.
   */
  @Test
  public void setClassPathWrongFiles() {
    logger.info("setClassPathWrongFiles");
    Project project = new Project("bla");
    logger.info("setClassPathsWrongDirectories");
    try {
      project
          .setClasspath("/home/bernd/eclipse_workspace/junittca_local/junittca.jar");
      fail("Es konnte doch ein Klassenpfad gesetzt werden:"
          + project.getClasspath());
    } catch (Exception e) {
      assertEquals(
          "Der Klassenpfad /home/bernd/eclipse_workspace/junittca_local/junittca.jar ist ungültig.\nBitte geben Sie ein existierendes Verzeichnis ein.",
          e.getMessage());
    }

    try {
      project
          .setClasspath("/home/bernd/eclipse_workspace/junittca_local/Bla.class");
      fail("Es konnte doch ein Klassenpfad gesetzt werden:"
          + project.getClasspath());
    } catch (Exception e) {
      assertEquals(
          "Der Klassenpfad /home/bernd/eclipse_workspace/junittca_local/Bla.class ist ungültig.\nBitte geben Sie ein existierendes Verzeichnis ein.",
          e.getMessage());
    }

    try {
      project
          .setClasspath("/home/bernd/eclipse_workspace/junittca_local/tiefe.svg");
      fail("Es konnte doch ein Klassenpfad gesetzt werden:"
          + project.getClasspath());
    } catch (Exception e) {
      assertEquals(
          "Der Klassenpfad /home/bernd/eclipse_workspace/junittca_local/tiefe.svg ist ungültig.\nBitte geben Sie ein existierendes Verzeichnis ein.",
          e.getMessage());
    }
View Full Code Here

   * Test setting classpath with correct directories.
   *
   */
  @Test
  public void setClassPathsDirectories() throws Exception {
    Project project = new Project("bla");
    logger.info("setClassPathsWrongDirectories");

    project.setClasspath(CLASSPATH);
  }
View Full Code Here

TOP

Related Classes of de.berndsteindorff.junittca.model.Project

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.