Results 1 to 4 of 4
  1. #1
    albertkao is offline Member
    Join Date
    Apr 2010
    Posts
    9
    Rep Power
    0

    Default Junit3 error: Implicit super constructor TestCase() is not visible

    The following code has this error compiled in Eclipse:
    Implicit super constructor TestCase() is not visible. Must explicitly invoke another constructor

    Java Code:
    package com.my.prog; 
    
    
    import junit.framework.*; 
    import javax.naming.*; 
    import javax.rmi.PortableRemoteObject; 
    
    
    public abstract class TestProIndexBean extends TestCase { 
    
        static { 
           System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); 
           System.setProperty(Context.PROVIDER_URL, "iiop://localhost:7001" ); 
        } 
    
        private ProIndex proIndex = null; 
        private ProIndexHome home = null;   
    
        protected void setUp() throws Exception { 
        
            super.setUp(); 
            if( home == null ) { 
                Context context = new InitialContext(); 
                home = (ProIndexHome)PortableRemoteObject.narrow( 
                    context.lookup("com.my.prog.business.ProIndexHome"), 
                    ProIndexHome.class); 
            } 
            proIndex = home.create(); 
        } 
    
        protected void tearDown() throws Exception { 
            proIndex.remove(); 
            super.tearDown(); 
        } 
    
        public void testProIndexRequest1() throws Exception { 
        
            System.out.println("testProIndexRequest1()"); 
            ProIndexRequest request = new ProIndexRequest(); 
            ProIndexResponse actualReturn = proIndex.getProIndexInfo(request); 
            this.assertEquals("0000", actualReturn.getCd()); 
             	
        } 
    }

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default

    Is that supposed to be abstract?

  3. #3
    albertkao is offline Member
    Join Date
    Apr 2010
    Posts
    9
    Rep Power
    0

    Default

    Removing "abstract" has this error compiled in with junit 3.8.2 & jdk6 & Eclipse:
    Implicit super constructor TestCase() is not visible for default constructor. Must define an explicit constructor
    public class TestProIndexBean extends TestCase {

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default

    Can you see the code for TestCase?
    Ah.
    Hang on, I wonder if they removed the public no-args constructor?

    In any case that shouldn't be relied on, so create a constructor that uses the named constructor:
    Java Code:
    public TestProIndexBean() {
        super("TestProIndexBean");
    }
    It's been a while since I've used JUnit 3, though, so I can't remember if this is how they're supposed to be written.

Similar Threads

  1. calling variable using super super..
    By Stephen Douglas in forum New To Java
    Replies: 7
    Last Post: 08-16-2010, 06:12 AM
  2. Private constructor and super()
    By Basit56 in forum Advanced Java
    Replies: 9
    Last Post: 08-21-2009, 06:19 AM
  3. Replies: 0
    Last Post: 06-26-2009, 07:40 AM
  4. constructor ... is not visible
    By emceenugget in forum New To Java
    Replies: 2
    Last Post: 09-27-2008, 05:12 AM
  5. error with super.xxxxx
    By Rgfirefly24 in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 08:13 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
  •