Results 1 to 10 of 10
  1. #1
    sonny's Avatar
    sonny is offline Senior Member
    Join Date
    Feb 2010
    Location
    North West England
    Posts
    146
    Rep Power
    0

    Unhappy Mark Dexter persistence tutorial Junit problems

    i've just started the second tutorial in the Mark Dexter eclipse tutorials
    and having a problem with using Junit 4.
    I cant get it to work with Junit 4

    my AllTest class worked fine with Junit 3
    so as directed i have changed the syntax of the class file thus:
    Java Code:
    package org.persistence.tutorial;
    
    import org.junit.runner.*;
    import org.junit.runners.*;
     
    
    @RunWith(Suite.class)
    @Suite.SuiteClasses(value={
    		BookTest.class,
    		PersonTest.class,
    		MyLibraryTest.class,
    		
    })
    
    public class AllTests {
    	
    	}
    i added Junit 4 source files to the build path ( although quick fix wouldnt do this for me, i had to do it manually.

    Then i opened the run configurations dialogue and selected Junit 4 as the test runner.

    but it will not run the test i get a list of console output. see below.

    I cant understand what I have missed. I have followed the instructions to the letter.. excepting that quickfix would not automatically add junit 4 to the buildpath for me. I had to do it manually.

    could this be something to do with using Stanford Universities version of Eclipse. i am currently running Version: 3.4.2 of eclipse

    here is the console output i get when i try to run the all test class.
    Java Code:
    java.lang.SecurityException: class "junit.framework.JUnit4TestCaseFacade"'s signer information does not match signer information of other classes in the same package
    	at java.lang.ClassLoader.checkCerts(Unknown Source)
    	at java.lang.ClassLoader.preDefineClass(Unknown Source)
    	at java.lang.ClassLoader.defineClass(Unknown Source)
    	at java.security.SecureClassLoader.defineClass(Unknown Source)
    	at java.net.URLClassLoader.defineClass(Unknown Source)
    	at java.net.URLClassLoader.access$000(Unknown Source)
    	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 java.lang.ClassLoader.loadClassInternal(Unknown Source)
    	at org.junit.internal.runners.OldTestClassRunner$OldTestClassAdaptingListener.asDescription(OldTestClassRunner.java:41)
    	at org.junit.internal.runners.OldTestClassRunner$OldTestClassAdaptingListener.startTest(OldTestClassRunner.java:31)
    	at junit.framework.TestResult.startTest(TestResult.java:151)
    	at junit.framework.TestResult.run(TestResult.java:103)
    	at junit.framework.TestCase.run(TestCase.java:120)
    	at junit.framework.TestSuite.runTest(TestSuite.java:230)
    	at junit.framework.TestSuite.run(TestSuite.java:225)
    	at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
    	at org.junit.internal.runners.CompositeRunner.run(CompositeRunner.java:29)
    	at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
    	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
    	at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    :p I still have my "L" plates on...... directions and explanations are far more help than blaring your Horn! :p Watching:CS106a on YouTube \Reading The Art & Science of Java by Eric S Roberts

  2. #2
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    952
    Rep Power
    5

    Default

    Quote Originally Posted by sonny View Post
    could this be something to do with using Stanford Universities version of Eclipse. i am currently running Version: 3.4.2 of eclipse
    Yeah, I think that could very well be. I've never used the Stanford version of Eclipse, which means I had some issues with the Stanford exercise code when I was doing them, but I had no problems with the Mark Dexter tutorials.

    -Gary-

  3. #3
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default

    Quote Originally Posted by sonny View Post
    I cant get it to work with Junit 4
    make sure the j4unit library is include in eclipse like in the following pic



    if not, try to add your j4unit...jar into your classpath from eclipse. you can also try to create a new test-source-folder for junit4 tests.

  4. #4
    sonny's Avatar
    sonny is offline Senior Member
    Join Date
    Feb 2010
    Location
    North West England
    Posts
    146
    Rep Power
    0

    Unhappy

    okay the Junit4 icon and the JRE system library never appear in package explorer,
    they have never appeared there. I noticed this in the first tutorials but no issues arose as a result of them not being there.

    i checked again that Junit 4 is in the build path, and it is.
    but i removed it any way, rebooted eclipse and put it back again.
    i deleted the AllTest class and and opened a new Junit test case in the test subfolder.
    eclipse automatically checked the Junit 4 options and I wrote the class again from scratch.
    still got loads of red console output and no test.

    I checked around a few other things, but :confused:
    heres a screen shot of the libraries on my build path.
    it looks kid of right to me, but to be honest i dont know if it is or not.
    Attached Thumbnails Attached Thumbnails Mark Dexter persistence tutorial Junit problems-ecl.jpg  
    :p I still have my "L" plates on...... directions and explanations are far more help than blaring your Horn! :p Watching:CS106a on YouTube \Reading The Art & Science of Java by Eric S Roberts

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by sonny View Post
    heres a screen shot of the libraries on my build path.
    Jeez, can't you upload a smaller screenshot please, have merci. ;-)

    kind regards,

    Jos

  6. #6
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default

    Quote Originally Posted by sonny View Post
    heres a screen shot of the libraries on my build path.

    try this: right-click your persistence project, choose Build Path -> Configure Build Path and then select Libraries and delete the package for JUnit 3 from your project class path.

  7. #7
    sonny's Avatar
    sonny is offline Senior Member
    Join Date
    Feb 2010
    Location
    North West England
    Posts
    146
    Rep Power
    0

    Default

    Quote Originally Posted by JosAH View Post
    Jeez, can't you upload a smaller screenshot please, have merci. ;-)

    kind regards,

    Jos
    it does enlarge if you click on it ;-)
    :p I still have my "L" plates on...... directions and explanations are far more help than blaring your Horn! :p Watching:CS106a on YouTube \Reading The Art & Science of Java by Eric S Roberts

  8. #8
    sonny's Avatar
    sonny is offline Senior Member
    Join Date
    Feb 2010
    Location
    North West England
    Posts
    146
    Rep Power
    0

    Default Solved

    Quote Originally Posted by j2me64 View Post
    try this: right-click your persistence project, choose Build Path -> Configure Build Path and then select Libraries and delete the package for JUnit 3 from your project class path.

    cool that seems to have worked. it works fine now :)

    thanks j2me64
    Last edited by sonny; 05-24-2010 at 04:52 PM. Reason: added relevent quote
    :p I still have my "L" plates on...... directions and explanations are far more help than blaring your Horn! :p Watching:CS106a on YouTube \Reading The Art & Science of Java by Eric S Roberts

  9. #9
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by sonny View Post
    it does enlarge if you click on it ;-)
    My mother told me not to click on anybody else's thumbnails; humble and obedient as I am I never do that.

    kindest regards,

    Jos ;-)

  10. #10
    sonny's Avatar
    sonny is offline Senior Member
    Join Date
    Feb 2010
    Location
    North West England
    Posts
    146
    Rep Power
    0

    Talking

    Quote Originally Posted by JosAH View Post
    My mother told me not to click on anybody else's thumbnails; humble and obedient as I am I never do that.

    kindest regards,

    Jos ;-)
    All my Mum told me was not to bite mine.
    I should do well to remember your mother's advice in future
    :-)
    Sonny
    :p I still have my "L" plates on...... directions and explanations are far more help than blaring your Horn! :p Watching:CS106a on YouTube \Reading The Art & Science of Java by Eric S Roberts

Similar Threads

  1. Persistence technology
    By Hugo in forum AWT / Swing
    Replies: 6
    Last Post: 05-09-2010, 01:08 PM
  2. Replies: 2
    Last Post: 04-21-2010, 07:34 PM
  3. Replies: 1
    Last Post: 02-12-2010, 02:50 PM
  4. Name persistence is not bound in this Context
    By tascoa in forum Java Servlet
    Replies: 1
    Last Post: 12-15-2009, 11:01 PM
  5. Container Managed Persistence
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-27-2007, 11:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •