-
Notifications
You must be signed in to change notification settings - Fork 233
/
Copy pathFigureFactoryTest.java
46 lines (37 loc) · 1.26 KB
/
FigureFactoryTest.java
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
package coordinate;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
public class FigureFactoryTest {
@Test
public void line() {
List<Point> points = Arrays.asList(
Point.of(1, 2),
Point.of(2, 3));
Figure figure = FigureFactory.getInstance(points);
assertThat(figure).isInstanceOfAny(Line.class);
assertThat(figure.getName()).isEqualTo("선");
}
@Test
public void triangle() {
List<Point> points = Arrays.asList(
Point.of(1, 1),
Point.of(4, 1),
Point.of(1, 4));
Figure figure = FigureFactory.getInstance(points);
assertThat(figure).isInstanceOfAny(Triangle.class);
assertThat(figure.getName()).isEqualTo("삼각형");
}
@Test
public void rectangle() {
List<Point> points = Arrays.asList(
Point.of(1, 1),
Point.of(4, 1),
Point.of(1, 4),
Point.of(4, 4));
Figure figure = FigureFactory.getInstance(points);
assertThat(figure).isInstanceOfAny(Rectangle.class);
assertThat(figure.getName()).isEqualTo("사각형");
}
}