Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

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

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

    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
    Member goldest's Avatar
    Join Date
    Oct 2009
    Location
    Pune, India
    Posts
    63
    Thanks
    1
    Thanked 12 Times in 10 Posts

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

    Seems like TestCase constructor has private access.

    Please verify.

    Goldest
    Java Is A Funny Language... Really!

    Sun: Java Coding Conventions

    Click on THANKS if you like the solution provided.
    Click on Star if you are really impressed with the solution.

  3. #3
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

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

    I think it means you have to have a default constructor for TestCase and you don't.
    public TestCase()
    {
     
    }

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

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

    Quote Originally Posted by javapenguin View Post
    I think it means you have to have a default constructor for TestCase and you don't.
    No, it does not. And once again, if you have to preface a post with "I think", I suggest you be sure before posting...would have taken 30seconds to write something to test if you receive a compile time error....no-arg constructors are called implicitly.

    goldest is along the right lines....but I'm a bit confused because the API for JUnit states the no-arg constructor for TestCase is public...and I receive no error when I try and reproduce a TestCase with no constructor. That being said the no-arg constructor in the API states
    This method is not intended to be used by mere mortals without calling setName().
    I suggest you create a no-arg constructor and call the parent constructor that sets the name and see what that does.

  5. The Following User Says Thank You to copeg For This Useful Post:

    javapenguin (January 21st, 2011)

Similar Threads

  1. SUPER SIMPLE QUESTION!!!
    By Options in forum What's Wrong With My Code?
    Replies: 7
    Last Post: September 2nd, 2010, 09:21 PM
  2. Super Mario Frustration
    By Bryan in forum The Cafe
    Replies: 2
    Last Post: June 11th, 2010, 02:46 PM
  3. [SOLVED] Using class implicit toString() for array index
    By Quetzalma in forum Java Theory & Questions
    Replies: 2
    Last Post: February 3rd, 2010, 05:04 PM
  4. Replies: 2
    Last Post: November 3rd, 2009, 06:28 AM
  5. [SOLVED] JTextField not visible in swing
    By Sterzerkmode in forum AWT / Java Swing
    Replies: 4
    Last Post: May 21st, 2009, 07:37 AM