Cześć, potrzebuję wykonać test sprawdzający pole prostokąta (potem obwód i inne figury). Wszystko utworzone, klasa Runner, klasa Rectangle, no ale z tym testem mam kłopot. Proszę o pomoc:)
public class Rectangle {
double a;
double b;
public Rectangle(double a, double b) {
this.a = a;
this.b = b;
}
public double getArea() {
return a * b;
}
public double getPerimeter() {
return (2 * (a + b));
}
}
public class Runner {
public static void main(String[] args) {
Rectangle liczymy = new Rectangle(5, 10);
System.out.println("Pole prostokąta: " + liczymy.getArea());
System.out.println("Obwód prostokąta: " + liczymy.getPerimeter());
}
}
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
public class Rectangle {
@Test
public void testGetArea (){
Rectangle l = new Rectangle();
assertEquals(50, l.getArea());
}
}