Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 658225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:54:35+00:00 2026-05-13T22:54:35+00:00

I have this JUnit test that I need help developing a Interface and Class

  • 0

I have this JUnit test that I need help developing a Interface and Class for, here is the test:

Box b1 = new DefaultBox( "abc" ); Box b2 = new DefaultBox( "def" ); 
Box b3 = new DefaultBox( "" ); 

assertEquals("abc", b1.contents()); 
assertEquals("[abc]", b1.toString()); 
assertTrue(b1.equals(b1)); assertFalse(b1.equals(b2)); 
assertFalse(b1.equals(null)); 
assertEquals("cba", b1.flip().contents()); 
assertEquals("", b3.flip().contents()); 

can anyone help me in developing a Default box class and a box interface to make these test pass? Any help would be most appreciated.

Updates

Ok I am trying to start a constuctor but i keep getting a run time error saying “Implicit super constructor Box() is undefined. Must explicitly invoke another constructor” Here is my class:

import javax.swing.Box;
public class DefaultBox extends Box{
       public DefaultBox(String string) {

    }
}

my Junit test is:

import static org.junit.Assert.*;
import javax.swing.Box;



public class question3_test {

    Box b1 = new DefaultBox( "abc" );
    Box b2 = new DefaultBox( "def" ); 
    Box b3 = new DefaultBox( "" );

    public void testquestion3(){
    assertEquals("abc", b1.contents()); 
    assertEquals("[abc]", b1.toString()); 
    assertTrue(b1.equals(b1)); assertFalse(b1.equals(b2)); 
    assertFalse(b1.equals(null)); 
    assertEquals("cba", b1.flip().contents()); 
    assertEquals("", b3.flip().contents()); 
    }

}

I have tried to remove the “extends Box” but then that gives me a run time error on the Junit test. Can anyone guide me on how to remove this implicit super constructor error?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:54:35+00:00Added an answer on May 13, 2026 at 10:54 pm

    What kind of help you need? Your question doesn’t seem so complex.

    • contents should return the string contained
    • toString should put it in brackets
    • equals should check if contents are equal
    • flip should return a new DefaultBox with reversed content

    I suppose this is homework, but the class that you have to implement it’s quite trivial..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JUnit test that fails because the milliseconds are different. In this
Hello StackOverflow Community, I have this JUnit Tests that need to run a Server
I have this form, in which i need to populate a combo box with
I have parametrized junit test that reads from several XML input files. In the
I have a junit test method that takes a CommonsMultipartFile object as a parameter.
How can I enforce that my test class covers a particular interface? Also is
I have a test class extending junit.framework.TestCase with several test methods.Each method opens a
I have a JUnit test that tests adding Strings to a Dictionary custom type.
I have this application where I implement the ActionBar Fragment interface. Underlying the interface,
I have this form: <%= form_tag posts_path, :method => :get, :class => search_nav do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.