-
Notifications
You must be signed in to change notification settings - Fork 738
Expand file tree
/
Copy pathLineTest.java
More file actions
38 lines (30 loc) · 1.19 KB
/
LineTest.java
File metadata and controls
38 lines (30 loc) · 1.19 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
package ladder;
import ladder.domain.Line;
import ladder.domain.Point;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
public class LineTest {
Point notConnected = new Point(false);
Point connected = new Point(true);
@Test
void 라인_생성() {
Line line = new Line(4, (idx, preConnected) -> false);
assertThat(line).isEqualTo(new Line(List.of(notConnected, notConnected, notConnected, notConnected)));
}
@Test
void 처음에만_연결() {
Line line = new Line(4, (idx, preConnected) -> idx == 0);
assertThat(line).isEqualTo(new Line(List.of(connected, notConnected, notConnected, notConnected)));
}
@Test
void 홀수번째만_연결() {
Line line = new Line(4, (idx, preConnected) -> idx % 2 != 0);
assertThat(line).isEqualTo(new Line(List.of(notConnected, connected, notConnected, connected)));
}
@Test
void 연속적으로_연결되면_예외() {
assertThatThrownBy(() -> new Line(4, (idx, preConnected) -> true)).isInstanceOf(IllegalArgumentException.class);
}
}