Package de.berndsteindorff.junittca.model

Examples of de.berndsteindorff.junittca.model.FileClassLoader2


   *
   * @throws ClassNotFoundException
   */
  @Test
  public void reloadClassesSimple() throws ClassNotFoundException {
    FileClassLoader2 fcl = new FileClassLoader2(CLASSPATH);

    List<ClassFile> classFiles = new ArrayList<ClassFile>(3);
    classFiles.add(new ClassFile(
        "de.berndsteindorff.junittca.model.test.ClassMethodsTest",
        CLASSPATH + DIRSEP));
    classFiles.add(new ClassFile(NAME_DUMMYTEST, CLASSPATH + DIRSEP));
    classFiles.add(new ClassFile(
        "de.berndsteindorff.junittca.model.test.ProjectTest", CLASSPATH
            + DIRSEP));
    List<Class<?>> classes = fcl.reloadClasses(classFiles);

    assertEquals(3, classes.size());
    for (int i = 0; i < classFiles.size(); i++) {
      assertEquals(classFiles.get(i).getClassName(), classes.get(i)
          .getName());
View Full Code Here


    Project project = new Project("Bernds Projekt111");
    project.addTestClass(new ClassFile(NAME_DUMMYTEST, CLASSPATH + DIRSEP));

    assertEquals(1, project.getActualTestClasses().size());

    FileClassLoader2 fcl = new FileClassLoader2(Const.CLASSPATH);
    List<Class<?>> classes = fcl.reloadClasses(project
        .getActualTestClasses());

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

   */
  @Test
  public void loadClass() throws ClassNotFoundException {
    logger.info("loadClass");
    ClassFile cf = null;
    FileClassLoader2 fcl = new FileClassLoader2(Const.CLASSPATH);
    cf = fcl.findClass(new File(Const.CLASSPATH + DIRSEP + "de" + DIRSEP
        + "berndsteindorff" + DIRSEP + "junittca_local" + DIRSEP + "model"
        + DIRSEP + "test" + DIRSEP + "RunTest.class"));

    assertEquals("de.berndsteindorff.junittca.model.test.RunTest", cf
        .getClassName());
View Full Code Here

   */
  @Test
  public void loadClassOtherClassPathEnd() throws ClassNotFoundException {
    logger.info("loadClassOtherClassPathEnd");
    ClassFile cf = null;
    FileClassLoader2 fcl = new FileClassLoader2(Const.CLASSPATH + DIRSEP);
    cf = fcl.findClass(new File(Const.CLASSPATH + DIRSEP + "de" + DIRSEP
        + "berndsteindorff" + DIRSEP + "junittca_local" + DIRSEP + "model"
        + DIRSEP + "test" + DIRSEP + "RunTest.class"));

    assertEquals("de.berndsteindorff.junittca.model.test.RunTest", cf
        .getClassName());
View Full Code Here

   */
  @Test
  public void loadClassWithNoTest() {
    logger.info("loadClassWithNoTest");
    ClassFile cf = null;
    FileClassLoader2 fcl = new FileClassLoader2(Const.CLASSPATH + DIRSEP);
    cf = fcl.findClass(new File(Const.CLASSPATH + DIRSEP + "de" + DIRSEP
        + "berndsteindorff" + DIRSEP + "junittca_local" + DIRSEP + "model"
        + DIRSEP + "test" + DIRSEP + "DummyMain.class"));
    assertNull(cf);
  }
View Full Code Here

   */
  @Test
  public void loadClassFromExtClasspath() throws ClassNotFoundException {
    logger.info("loadClassFromExtClasspath");
    ClassFile cf = null;
    FileClassLoader2 fcl = new FileClassLoader2(Const.CLASSPATH_TESTPROJEKT);
    cf = fcl.findClass(new File(Const.CLASSPATH_TESTPROJEKT + DIRSEP + "de"
        + DIRSEP + "berndsteindorff" + DIRSEP + "junittca_local" + DIRSEP
        + "tests" + DIRSEP + "StocksSupportOkTest.class"));

    assertEquals("de.berndsteindorff.junittca.tests.StocksSupportOkTest",
        cf.getClassName());
View Full Code Here

   */
  @Test
  public void loadClassFromThwoClasspaths() throws ClassNotFoundException {
    logger.info("loadClassFromExtClasspath");
    ClassFile cf = null;
    FileClassLoader2 fcl = new FileClassLoader2(CLASSPATH_TESTPROJEKT
        + PATHSEP + CLASSPATH);
    cf = fcl.findClass(new File(CLASSPATH_TESTPROJEKT + DIRSEP + "de"
        + DIRSEP + "berndsteindorff" + DIRSEP + "junittca_local" + DIRSEP
        + "tests" + DIRSEP + "StocksSupportOkTest.class"));

    assertEquals("de.berndsteindorff.junittca.tests.StocksSupportOkTest",
        cf.getClassName());
    assertEquals(CLASSPATH_TESTPROJEKT + DIRSEP, cf.getClassPath());

    cf = null;
    fcl = new FileClassLoader2(CLASSPATH + PATHSEP + CLASSPATH_TESTPROJEKT);
    cf = fcl.findClass(new File(CLASSPATH_TESTPROJEKT + DIRSEP + "de"
        + DIRSEP + "berndsteindorff" + DIRSEP + "junittca_local" + DIRSEP
        + "tests" + DIRSEP + "StocksSupportOkTest.class"));

    assertEquals("de.berndsteindorff.junittca.tests.StocksSupportOkTest",
        cf.getClassName());
View Full Code Here

   * Test setting classpath in many different ways.
   */
  @Test
  public void settingClassPaths() {
    logger.info("settingClassPaths");
    FileClassLoader2 fcl = new FileClassLoader2(Const.CLASSPATH);
    assertEquals(1, fcl.getClassPaths().size());
    assertEquals(CLASSPATH + DIRSEP, fcl.getClassPaths().get(0));

    fcl = new FileClassLoader2(CLASSPATH + DIRSEP);
    assertEquals(1, fcl.getClassPaths().size());
    assertEquals(CLASSPATH + DIRSEP, fcl.getClassPaths().get(0));

    fcl = new FileClassLoader2(CLASSPATH + PATHSEP + CLASSPATH_TESTPROJEKT);
    assertEquals(2, fcl.getClassPaths().size());
    assertEquals(CLASSPATH + DIRSEP, fcl.getClassPaths().get(0));
    assertEquals(CLASSPATH_TESTPROJEKT + DIRSEP, fcl.getClassPaths().get(1));

    fcl = new FileClassLoader2(CLASSPATH_TESTPROJEKT + DIRSEP + PATHSEP
        + CLASSPATH + DIRSEP);
    assertEquals(2, fcl.getClassPaths().size());
    assertEquals(CLASSPATH_TESTPROJEKT + DIRSEP, fcl.getClassPaths().get(0));
    assertEquals(CLASSPATH + DIRSEP, fcl.getClassPaths().get(1));
  }
View Full Code Here

            + DIRSEP));
    expTestClasses.add(new ClassFile(
        "de.berndsteindorff.junittca.model.test.RunTest", CLASSPATH
            + DIRSEP));

    FileClassLoader2 fcl = new FileClassLoader2(CLASSPATH);

    Class<?> class1 = DummyTest.class;
    Class<?> class2 = DummyTest.class;

    assertEquals(class1, class2);

    List<ClassFile> done = fcl.findClassesInClassPath(new UserConfiguration());
    Collections.sort(done);

    assertEquals(expTestClasses.size(), done.size());
    assertEquals(expTestClasses, done);
  }
View Full Code Here

        CLASSPATH_TESTPROJEKT + DIRSEP));
    expTestClasses.add(new ClassFile(
        "de.berndsteindorff.junittca.tests.StocksSupportOkTest",
        CLASSPATH_TESTPROJEKT + DIRSEP));

    FileClassLoader2 fcl = new FileClassLoader2(CLASSPATH + PATHSEP
        + CLASSPATH_TESTPROJEKT);

    List<ClassFile> done = fcl.findClassesInClassPath(new UserConfiguration());
    Collections.sort(done);

    assertEquals(10, done.size());
    assertEquals(expTestClasses, done);
  }
View Full Code Here

TOP

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

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.