-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectangleTester.java
More file actions
50 lines (37 loc) · 1.03 KB
/
Copy pathRectangleTester.java
File metadata and controls
50 lines (37 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class RectangleTester {
private Rectangle x, y, z;
@Before
public void setUp(){
x = new Rectangle(5, 5);
y = new Rectangle(6, 6);
z = new Rectangle(4, 4);
}
@Test
public void testIsSquare() {
assertTrue("Square function error with boolean", x.isSquare()==true);
}
@Test
public void testShowArea(){
assertTrue("Area computed incorrectly", x.showArea() == 25);
}
@Test
public void testShowPerim(){
assertTrue("Perimeter computed incorrectly", x.showPerim() == 20);
}
@Test
public void testBiggerOrSmallerIsSmaller(){
assertTrue("Inccorect computation of smaller areas", x.biggerOrSmaller(y) == -11);
}
@Test
public void testBiggerOrSmallerIsBigger(){
assertTrue("Inccorect computation of bigger areas", x.biggerOrSmaller(z) == 9);
}
@Test
public void testBiggerOrSmallerIsSame(){
Rectangle a = new Rectangle (5, 5);
assertTrue("Inccorect computation of same areas", x.biggerOrSmaller(a) == 0);
}
}