JUnit


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: JUnit

  1. #1
    Join Date
    Jul 2010
    Posts
    9

    JUnit

    Hi,

    I wrote a JUnit test and I am using eclipse but it won't run at all. This is what it keeps giving me in errors:

    Class not found com.sqc.Testers.GenesisAdapterTester
    java.lang.ClassNotFoundException: com.sqc.Testers.GenesisAdapterTester
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693 )
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:4 29)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


    This is my class:

    package com.sqc.Testers;
    import junit.framework.*;

    public class GenesisAdapterTester extends TestCase {

    private java.util.List emptyList;

    protected void setUp() {
    emptyList = new java.util.ArrayList();
    }

    protected void tearDown() {
    emptyList = null;
    }

    public void testSomeBehavior() {
    assertEquals("Empty list should have 0 elements", 0, emptyList.size());
    }

    public void testForException() {
    try {
    Object o = emptyList.get(0);
    fail("Should raise an IndexOutOfBoundsException");
    }
    catch (IndexOutOfBoundsException success) {
    }
    }

    public static Test suite() {
    System.out.println("hello");
    return new TestSuite( GenesisAdapterTester.class );
    }
    }


    It doesn't even print out the "hello" in Test Suite so it seems like that function isn't even used. Does anyone have any suggestions on what is wrong? I already have JUnit Library (with the junit.jar file) added to the build path. I even tried both Junit 3 and JUnit 4. Any hints on how to fix this would be really appreciated!!

  2. #2
    Join Date
    Jul 2010
    Posts
    9
    Never mind I figured it out

Similar Threads

  1. Junit 4.1 @Ignore is not working
    By gary.liu1119 in forum Java
    Replies: 0
    Last Post: 10-12-2007, 09:14 AM
  2. Junit problem
    By trixma in forum Java
    Replies: 0
    Last Post: 08-26-2005, 09:21 PM
  3. Junit tests for toString()
    By trixma in forum Java
    Replies: 1
    Last Post: 08-22-2005, 01:35 AM
  4. problem in running junit report
    By yogeshseth in forum Java
    Replies: 0
    Last Post: 07-19-2005, 05:01 AM
  5. Replies: 0
    Last Post: 07-06-2005, 05:06 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center