title: Need Help on JUnit Test
body: <p>I was told that i should make a JUnit Test to check if all the codes are working. I dont know anything about JUnit that Is why im asking you guys. Anyway, here is my code:</p>
  
  <pre><code>package cst8284.shape;
  
  public abstract class BasicShape {
  
      private double width;
  
      public double getWidth(){return width;}
      public void setWidth(double width){this.width = width;}
  
      @Override
      public String toString(){
          return ("BasicShape Overrides " + super.toString());
      }
  
      public abstract double getArea();
      public abstract double getPerimeter();
  
  }
  </code></pre>
  
  <p>Here is where i should make testing,</p>
  
  <pre><code>package cst8284.shape;
  
  public class TestBasicShape {
  
      public static void main(String[] args){
  
          Circle circle = new Circle(2.0);
          System.out.println(circle.toString());
          System.out.println("The perimeter of the circle is " + circle.getPerimeter());
          System.out.println("The area of the circle is: " + circle.getArea() + "\n");
  
          Square square = new Square(2.0);
          System.out.println(square.toString());
          System.out.println("The perimeter of the square is " + square.getPerimeter());
          System.out.println("The area of the square is: " + square.getArea() + "\n");
  
          Rectangle rect1 = new Rectangle(2.0,3);
          System.out.println(rect1.toString());
          System.out.println("The perimeter of the rectangle is " + rect1.getPerimeter());
          System.out.println("The area of the rectangle is: " + rect1.getArea() +"\n");
  
          Rectangle rect2 = new Rectangle(rect1);
          Rectangle rect3 = new Rectangle(2.0, 1.0);
  
          System.out.println("The square and the circle are " + (square.equals(circle)?"":"not ") + "equal");
          System.out.println("The rectangle and the square are " + (rect1.equals(square)?"":"not ") + "equal");
          System.out.println("Rectangles 1 and 2 are " + (rect2.equals(rect1)?"":"not ") + "equal");
          System.out.println("Rectangles 2 and 3 are " + (rect2.equals(rect3)?"":"not ") + "equal");
  
      }
  
  
  }
  
  package cst8284.shape;
  
  public class Circle extends BasicShape {
  
      public Circle(){
  
      }
      public Circle(double width){
          setWidth(width);
      }
      public Circle(Circle circle) {
          setWidth(circle.getWidth());
      }
  
      //Getters
      public double getArea() {
          return Math.PI * (getWidth()/2) * (getWidth()/2);
      }
      public double getPerimeter() {
          return 2*Math.PI*getWidth()/2;
      }
  
  
      @Override
      public String toString(){
          return ("Circle Overrides " + super.toString());
      }
  
      @Override
      public boolean equals(Object obj){
          if (!(obj instanceof Circle)) {
              return false;
          }
          Circle c = (Circle)obj;
          return (this.getWidth() == c.getWidth());
          }
  }
  
  package cst8284.shape;
  
  public class Square extends BasicShape{
  
      public Square() {
  
      }
  
      public Square(double width) {
          setWidth(width);
      }
      public Square(Square square) {
          setWidth(square.getWidth());
      }
  
      //Getters
  
      public double getArea() {
          return getWidth()*2;
      }
      public double getPerimeter() {
          return 4*getWidth();
      }
  
  
  
      @Override
      public String toString(){
          return ("Square Overrides " + super.toString());
      }
  
      @Override
      public boolean equals(Object obj){
          if (!(obj instanceof Square)) {
              return false;
          }
          Square s = (Square)obj;
          return (this.getWidth() == s.getWidth());
          }
  }
  
  package cst8284.shape;
  
  public class Rectangle extends Square{
  
      private double height;
  
      public Rectangle() {
  
      }
      public Rectangle(double width, double height) {
          setWidth(width);
          setHeight(height);
      }
      public Rectangle(Rectangle rectangle) {
          setWidth(rectangle.getWidth());
          setHeight(rectangle.getHeight());
      }
  
  
      public double getHeight(){
          return height;
      }
      public void setHeight(double height){
          this.height=height;
      }
  
  
      public double getArea() {
          return getWidth()*getHeight();
      }
      public double getPerimeter() {
          return 2*(getHeight()+getWidth());
      }
  
  
      @Override
      public String toString(){
          return ("Rectangle Overrides " + super.toString());
      }
      @Override
      public boolean equals(Object obj){
          if (!(obj instanceof Rectangle)) {
              return false;
          }
  
          Rectangle r = (Rectangle)obj;
          return (this.getWidth() == r.getWidth() &amp;&amp; this.getHeight() == r.getHeight());
      }
  }
  </code></pre>
  
  <p>In this program, i am trying to calculate the area and perimeter of Circle and Square(subclasses of BasicShape) and Rectangle(subclass of Square) and also trying to compare whether each shape are equal(in shape or in size)</p>
  
  <p>Thank you in advance!</p>