-
Notifications
You must be signed in to change notification settings - Fork 738
Expand file tree
/
Copy pathLadderRowTest.java
More file actions
33 lines (26 loc) · 1.03 KB
/
LadderRowTest.java
File metadata and controls
33 lines (26 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
package domain;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.util.List;
class LadderRowTest {
@Test
@DisplayName("사다리 행의 열은 전체 너비 - 1 만큼 생성된다.")
void createColumns() {
LadderRow ladderRow = new LadderRow(5, () -> true);
AtomicInteger count = new AtomicInteger();
ladderRow.forEach(column -> count.getAndIncrement());
assertThat(count.get()).isEqualTo(4);
}
@Test
@DisplayName("사다리에서 연결된 다음 열은 연결되지 않는다.")
void adjacentConnectionsDoNotOverlap() {
LadderRow ladderRow = new LadderRow(5, () -> true);
List<Boolean> expected = List.of(true, false, true, false);
AtomicInteger index = new AtomicInteger();
ladderRow.forEach(column -> {
assertThat(column).isEqualTo(expected.get(index.getAndIncrement()));
});
}
}