diff --git a/README.md b/README.md index 98fae86a00..23da9acdc9 100644 --- a/README.md +++ b/README.md @@ -53,4 +53,54 @@ - [x] 사다리 높이만큼 반복 - 결과 -- [x] 사람별 사다리게임 결과 \ No newline at end of file +- [x] 사람별 사다리게임 결과 + + +--- + +TDD로 구현 + +도메인 +1. point + current, right + 둘다 true일 수는 없음 + current > left로 이동 + right > right로 이동 + 둘다 false > 그대로 아래로 이동 + + 오류 방지 + - 첫번째 point 생성 + - 다음 point 생성 + - 마지막 point 생성 + +2. Cross + 현재 위치 position + point + + move + - right > index+1 + - left > index-1 + - down > index + +- [x] 출력 + - "-----", " " + +2. line + crosses + +- [x] 출력 + - "|-----| |-----|" + +3. ladder + lines + +- [x] 출력 + - "|-----| |-----|" + - "| |------| |" + - "|-----| |-----|" + +- [x] 결과 조회 + + +Usernames +- [x] 이름 중복 체크 \ No newline at end of file diff --git a/src/main/java/nextstep/ladder/Cross.java b/src/main/java/nextstep/ladder/Cross.java new file mode 100644 index 0000000000..e9daa78472 --- /dev/null +++ b/src/main/java/nextstep/ladder/Cross.java @@ -0,0 +1,30 @@ +package nextstep.ladder; + +public class Cross { + private int position; + private Point point; + + public Cross(int position, Point point) { + this.position = position; + this.point = point; + } + + public int move() { + if(point.move() == Direction.RIGHT) { + return position + 1; + } else if(point.move() == Direction.LEFT) { + return position - 1; + } + + return position; + } + + public String getCrossForPrint(String trueSymbol, String falseSymbol) { + if(point.move() == Direction.RIGHT) { + return trueSymbol; + } + + return falseSymbol; + } + +} diff --git a/src/main/java/nextstep/ladder/Direction.java b/src/main/java/nextstep/ladder/Direction.java new file mode 100644 index 0000000000..0fe988dc95 --- /dev/null +++ b/src/main/java/nextstep/ladder/Direction.java @@ -0,0 +1,7 @@ +package nextstep.ladder; + +public enum Direction { + LEFT, + RIGHT, + DOWN; +} diff --git a/src/main/java/nextstep/ladder/Ladder.java b/src/main/java/nextstep/ladder/Ladder.java index ba41ef5564..096a7b2877 100644 --- a/src/main/java/nextstep/ladder/Ladder.java +++ b/src/main/java/nextstep/ladder/Ladder.java @@ -1,64 +1,53 @@ package nextstep.ladder; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.IntStream; public class Ladder { - private Usernames usernames; - private Lines lines; - private List results; + private static final String LADDER_DELIMITER = "\n"; - public Ladder(Usernames usernames, Lines lines, List results) { - this.usernames = usernames; - this.lines = lines; - this.results = results; - } + private List lines; - public String getResultsForPrint() { - return results.stream() - .map(d -> String.format("%-6s", d)) - .collect(Collectors.joining()); + public Ladder(int countOfPerson, int height) { + this.lines = createLines(countOfPerson, height); } - public String getLadderForPrint(String trueSymbol, String falseSymbol) { - return String.join("\n", - usernames.toString(), - lines.toString(trueSymbol, falseSymbol), - getResultsForPrint() - ); + public Ladder(List lines) { + this.lines = new ArrayList<>(lines); } - public String getResult(String resultUsername) { - if ("all".equals(resultUsername)) { - return getAllResult(); + private List createLines(int countOfPerson, int height) { + List nLines = new ArrayList<>(); + + for (int i = 0; i < height; i++) { + nLines.add(new Line(countOfPerson)); } - return getResultByUsername(resultUsername); + return nLines; } - private Map getResultMap() { - Map result = IntStream.range(0, usernames.size()) - .boxed() - .collect(Collectors.toMap( - i -> usernames.getValues().get(i).getUsername(), - i -> results.get(lines.getPersonFinalResultIndex(i)) - )); - - return result; + public int move(int position) { + int index = position; + for (Line line : lines) { + index = line.move(index); + } + return index; } - private String getAllResult() { - Map resultMap = getResultMap(); - - return resultMap.entrySet() - .stream() - .map(d -> d.getKey() + " : " + d.getValue()).collect(Collectors.joining("\n")); + public String getLadderForPrint(String trueSymbol, String falseSymbol) { + return lines.stream() + .map(line -> line.getLineForPrint(trueSymbol, falseSymbol)) + .collect(Collectors.joining(LADDER_DELIMITER)); } - private String getResultByUsername(String resultUsername) { - return getResultMap().get(resultUsername); + //todo lines.get(0).getCrossSize() + public Map getAllResult() { + return IntStream.range(0, lines.get(0).getCrossSize()) + .boxed() + .collect(Collectors.toMap(i -> i, i -> move(i))); } } diff --git a/src/main/java/nextstep/ladder/LadderMain.java b/src/main/java/nextstep/ladder/LadderMain.java index 996be917b7..90ad6fbc00 100644 --- a/src/main/java/nextstep/ladder/LadderMain.java +++ b/src/main/java/nextstep/ladder/LadderMain.java @@ -9,10 +9,12 @@ public static void main(String[] args) { if (usernames.size() != results.size()) { throw new IllegalArgumentException("참여할 사람 수와 입력한 실행 결과의 수가 다릅니다."); } - Ladder ladder = new Ladder(usernames, new Lines(InputView.inputHeight(), usernames.size()), results); + Ladder ladder = new Ladder(usernames.size(), InputView.inputHeight()); + ResultView.printUsernames(usernames); ResultView.printLadder(ladder); + ResultView.printResults(results); String resultUserName = InputView.inputResultUserName(); - ResultView.printResult(ladder.getResult(resultUserName)); + ResultView.printResult(resultUserName, usernames, ladder, results); } } diff --git a/src/main/java/nextstep/ladder/Line.java b/src/main/java/nextstep/ladder/Line.java index 73a602d1f4..017be82867 100644 --- a/src/main/java/nextstep/ladder/Line.java +++ b/src/main/java/nextstep/ladder/Line.java @@ -1,27 +1,59 @@ package nextstep.ladder; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.stream.Collectors; public class Line { - private Points points; + private static final Random RANDOM = new Random(); + private static final String LINE_DELIMITER = "|"; + + private List crosses; public Line(int countOfPerson) { - points = new Points(countOfPerson); + createCrosses(countOfPerson); + } + + public Line(List crosses) { + this.crosses = crosses; } - public Line(Points points) { - this.points = points; + private void createCrosses(int countOfPerson) { + crosses = new ArrayList<>(); + + Point point = Point.first(RANDOM.nextBoolean()); + for (int i = 0; i < countOfPerson; i++) { + point = updatePoint(i, countOfPerson, point); + crosses.add(new Cross(i, point)); + } } - public String toString(String trueSymbol, String falseSymbol) { - return points.toString(trueSymbol, falseSymbol); + private Point updatePoint(int index, int countOfPerson, Point currentPoint) { + if (index == countOfPerson - 1) { + return currentPoint.last(); + } + if (index > 0) { + return currentPoint.next(RANDOM.nextBoolean()); + } + return currentPoint; } - public Integer getResultIndex(int index) { - return points.getResultIndex(index); + //todo + public int move(int position) { + return this.crosses.get(position).move(); } - @Override - public String toString() { - return points.toString(); + //todo + public int getCrossSize() { + return crosses.size(); } + + public String getLineForPrint(String trueSymbol, String falseSymbol) { + return LINE_DELIMITER + + crosses.stream() + .map(cross -> cross.getCrossForPrint(trueSymbol, falseSymbol)) + .collect(Collectors.joining(LINE_DELIMITER)); + } + } diff --git a/src/main/java/nextstep/ladder/Lines.java b/src/main/java/nextstep/ladder/Lines.java deleted file mode 100644 index 0da6aad371..0000000000 --- a/src/main/java/nextstep/ladder/Lines.java +++ /dev/null @@ -1,47 +0,0 @@ -package nextstep.ladder; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class Lines { - private final static String LINES_DELIMITER = "\n"; - private List lines = new ArrayList<>(); - - public Lines(int height, int countOfPerson) { - if (height <= 0) { - throw new IllegalArgumentException("사다리 높이는 0 이상 입력해주세요."); - } - generate(height, countOfPerson); - } - - public Lines(List lines) { - this.lines = lines; - } - - private void generate(int height, int countOfPerson) { - this.lines = Stream.generate(() -> new Line(countOfPerson)) - .limit(height) - .collect(Collectors.toList()); - } - - public List getValues() { - return this.lines; - } - - public String toString(String lineTrueSymbol, String lineFalseSymbol) { - return String.join( - LINES_DELIMITER, - this.lines - .stream() - .map((line) -> line.toString(lineTrueSymbol, lineFalseSymbol)) - .collect(Collectors.toList()) - ); - } - - public int getPersonFinalResultIndex(int personIndex) { - return lines.stream() - .reduce(personIndex, (index, line) -> line.getResultIndex(index), (a, b) -> b); - } -} diff --git a/src/main/java/nextstep/ladder/Point.java b/src/main/java/nextstep/ladder/Point.java index 440367ac71..8d197a576d 100644 --- a/src/main/java/nextstep/ladder/Point.java +++ b/src/main/java/nextstep/ladder/Point.java @@ -1,31 +1,40 @@ package nextstep.ladder; public class Point { - private boolean left; + private boolean current; private boolean right; - public Point(boolean left, boolean right) { - this.left = left; + public Point(boolean current, boolean right) { + if (current && right) { + throw new IllegalArgumentException("유효하지 않은 값입니다."); + } + this.current = current; this.right = right; } - public boolean getRight() { - return right; + public static Point first(boolean right) { + return new Point(false, right); } - public String getLineSymbol(String trueSymbol, String falseSymbol) { - return right ? trueSymbol : falseSymbol; + public Point next(boolean right) { + if (this.right) { + return new Point(this.right, false); + } + return new Point(this.right, right); } - public int getResultIndex(int index) { - return left ? index - 1 : (right ? index + 1 : index); + public Point last() { + return new Point(this.right, false); } - @Override - public String toString() { - return "Point{" + - "left=" + left + - ", right=" + right + - '}'; + public Direction move() { + if (current) { + return Direction.LEFT; + } + if (right) { + return Direction.RIGHT; + } + + return Direction.DOWN; } } diff --git a/src/main/java/nextstep/ladder/Points.java b/src/main/java/nextstep/ladder/Points.java deleted file mode 100644 index b903b599a4..0000000000 --- a/src/main/java/nextstep/ladder/Points.java +++ /dev/null @@ -1,53 +0,0 @@ -package nextstep.ladder; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -public class Points { - private static final Random RANDOM = new Random(); - private static final String LINE_DELIMITER = "|"; - private List points = new ArrayList<>(); - - public Points(int size) { - IntStream.range(0, size).forEach((i) -> { - boolean prevRight = i == 0 ? false : points.get(i - 1).getRight(); - boolean right = i == size - 1 ? false : generateRandomRightPoint(prevRight); - - points.add(new Point(prevRight, right)); - }); - } - - public Points(List points) { - this.points = points; - } - - private boolean generateRandomRightPoint(boolean prev) { - return prev ? false : RANDOM.nextBoolean(); - } - - public int size() { - return this.points.size(); - } - - public String toString(String trueSymbol, String falseSymbol) { - List result = this.points - .stream() - .map(point -> point.getLineSymbol(trueSymbol, falseSymbol)) - .limit(this.points.size() - 1) - .collect(Collectors.toList()); - - return LINE_DELIMITER + String.join(LINE_DELIMITER, result) + LINE_DELIMITER; - } - - public Integer getResultIndex(int index) { - return points.get(index).getResultIndex(index); - } - - @Override - public String toString() { - return points.stream().map(Point::toString).collect(Collectors.joining()); - } -} diff --git a/src/main/java/nextstep/ladder/ResultView.java b/src/main/java/nextstep/ladder/ResultView.java index 96702cf294..38e19cd008 100644 --- a/src/main/java/nextstep/ladder/ResultView.java +++ b/src/main/java/nextstep/ladder/ResultView.java @@ -1,16 +1,49 @@ package nextstep.ladder; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + public class ResultView { private static final String LINE_SYMBOL_TRUE = "-----"; private static final String LINE_SYMBOL_FALSE = " "; + private static final String LINE_SEPARATOR = "\n"; public static void printLadder(Ladder ladder) { System.out.println(ladder.getLadderForPrint(LINE_SYMBOL_TRUE, LINE_SYMBOL_FALSE)); } - public static void printResult(String result) { - System.out.println("실행 결과"); - System.out.println(result); + public static void printUsernames(Usernames usernames) { + System.out.println(usernames.getUsernamesForPrint()); + } + + public static void printResults(List results) { + String resultStr = results.stream() + .map(d -> String.format("%-6s", d)) + .collect(Collectors.joining()); + + System.out.println(resultStr); + } + + public static void printResult(String resultUserName, Usernames usernames, Ladder ladder2, List results) { + Map resultMap = allResult(usernames, ladder2, results); + if ("all".equals(resultUserName.toLowerCase())) { + String allResultStr = resultMap.entrySet() + .stream() + .map(entry -> entry.getKey() + " : " + entry.getValue()) + .collect(Collectors.joining(LINE_SEPARATOR)); + System.out.println(allResultStr); + return; + } + System.out.println(resultMap.get(resultUserName)); + } + + private static Map allResult(Usernames usernames, Ladder ladder2, List results) { + Map resultMap = ladder2.getAllResult(); + + return IntStream.range(0, usernames.size()).boxed() + .collect(Collectors.toMap(usernames::getUsername, i -> results.get(resultMap.get(i)))); } } diff --git a/src/main/java/nextstep/ladder/Usernames.java b/src/main/java/nextstep/ladder/Usernames.java index 1543bb5528..65c097d8f1 100644 --- a/src/main/java/nextstep/ladder/Usernames.java +++ b/src/main/java/nextstep/ladder/Usernames.java @@ -1,7 +1,9 @@ package nextstep.ladder; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; public class Usernames { @@ -11,30 +13,29 @@ public Usernames(List usernameStrs) { if (usernameStrs.size() == 0) { throw new IllegalArgumentException("참여자가 없습니다."); } + + Set uniqueUsernames = new HashSet<>(usernameStrs); + if (uniqueUsernames.size() < usernameStrs.size()) { + throw new IllegalArgumentException("중복된 이름이 존재합니다."); + } + this.usernames = usernameStrs.stream() .map((str) -> new Username(str)) .collect(Collectors.toList()); } - public List getValues() { - return usernames; + // //todo 이렇게 작성해도 되는지?? + public String getUsername(int index) { + return usernames.get(index).getUsername(); } public int size() { return usernames.size(); } - public int indexOf(String username) { - return usernames.indexOf(new Username(username)); - } - - public String toString() { - return String.join( - "", - this.usernames - .stream() - .map(str -> str.getUsernameForPrint()) - .collect(Collectors.toList()) - ); + public String getUsernamesForPrint() { + return usernames.stream() + .map(Username::getUsernameForPrint) + .collect(Collectors.joining()); } } diff --git a/src/test/java/nextstep/ladder/CrossTest.java b/src/test/java/nextstep/ladder/CrossTest.java new file mode 100644 index 0000000000..00c199572a --- /dev/null +++ b/src/test/java/nextstep/ladder/CrossTest.java @@ -0,0 +1,26 @@ +package nextstep.ladder; + +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +public class CrossTest { + + @Test + void right() { + Cross cross = new Cross(0, Point.first(true)); + assertThat(cross.move()).isEqualTo(1); + } + + @Test + void left() { + Cross cross = new Cross(1, Point.first(true).next(false)); + assertThat(cross.move()).isEqualTo(0); + } + + @Test + void down() { + Cross cross = new Cross(0, Point.first(true).next(false).last()); + assertThat(cross.move()).isEqualTo(0); + } +} diff --git a/src/test/java/nextstep/ladder/LadderTest.java b/src/test/java/nextstep/ladder/LadderTest.java index cd281bfa05..d8f1176521 100644 --- a/src/test/java/nextstep/ladder/LadderTest.java +++ b/src/test/java/nextstep/ladder/LadderTest.java @@ -5,6 +5,8 @@ import org.junit.jupiter.api.Test; import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; @@ -14,33 +16,44 @@ public class LadderTest { @BeforeAll static void setup() { - ladder = new Ladder( - new Usernames(Arrays.asList("test", "test2", "test3", "test4", "test5")), - new Lines(Arrays.asList( - new Line(new Points(Arrays.asList(new Point(false, false), new Point(false, true), new Point(true, false), new Point(false, true), new Point(true, false)))), - new Line(new Points(Arrays.asList(new Point(false, true), new Point(true, false), new Point(false, false), new Point(false, false), new Point(false, false)))), - new Line(new Points(Arrays.asList(new Point(false, true), new Point(true, false), new Point(false, false), new Point(false, true), new Point(true, false)))), - new Line(new Points(Arrays.asList(new Point(false, true), new Point(true, false), new Point(false, true), new Point(true, false), new Point(false, false)))), - new Line(new Points(Arrays.asList(new Point(false, false), new Point(false, true), new Point(true, false), new Point(false, true), new Point(true, false)))), - new Line(new Points(Arrays.asList(new Point(false, false), new Point(false, false), new Point(false, false), new Point(false, true), new Point(true, false)))) - )) - , Arrays.asList("result1", "result2", "result3", "result4", "result5")); + ladder = new Ladder(Arrays.asList( + new Line( + Arrays.asList(new Cross(0, new Point(false, false)), new Cross(1, new Point(false, true)), new Cross(2, new Point(true, false))) + ), new Line( + Arrays.asList(new Cross(0, new Point(false, true)), new Cross(1, new Point(true, false)), new Cross(2, new Point(false, false))) + ), new Line( + Arrays.asList(new Cross(0, new Point(false, false)), new Cross(1, new Point(false, true)), new Cross(2, new Point(true, false))) + ) + )); } @Test - @DisplayName("모든 사용자의 사다리 결과") - public void getAllResult() { - assertThat(ladder.getResult("all")) - .isEqualTo("test4 : result2\n" + - "test5 : result5\n" + - "test2 : result4\n" + - "test3 : result1\n" + - "test : result3"); + void move() { + assertThat(ladder.move(1)).isEqualTo(1); + } + + @Test + @DisplayName("모든 사용자의 사다리 출력") + void printResult() { + System.out.println(ladder.getLadderForPrint("-----", " ")); } @Test - @DisplayName("사용자별 사다리 결과") - public void getResult() { - assertThat(ladder.getResult("test4")).isEqualTo("result2"); + @DisplayName("특정 사용자의 사다리 결과") + void getResultByUserIndex() { + assertThat(ladder.move(0)) + .isEqualTo(2); + } + + @Test + @DisplayName("모든 사용자의 사다리 결과") + void getAllResult() { + Map result = new HashMap<>(); + result.put(0, 2); + result.put(1, 1); + result.put(2, 0); + + assertThat(ladder.getAllResult()) + .isEqualTo(result); } } diff --git a/src/test/java/nextstep/ladder/LineTest.java b/src/test/java/nextstep/ladder/LineTest.java index 78089515a0..2ab886154c 100644 --- a/src/test/java/nextstep/ladder/LineTest.java +++ b/src/test/java/nextstep/ladder/LineTest.java @@ -1,14 +1,25 @@ package nextstep.ladder; -//import org.junit.jupiter.api.DisplayName; -//import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; + +import static org.assertj.core.api.Assertions.assertThat; public class LineTest { -// @Test -// @DisplayName("중복되는 가로선이 없는지 출력 확인") -// void check() { -// Line line2 = new Line(6); -// System.out.println(line2.toString("-----", " ")); -// } + private static Line line; + + @BeforeAll + static void setUpBeforeClass() { + line = new Line( + Arrays.asList(new Cross(0, new Point(false, true)), new Cross(0, new Point(true, false)), new Cross(0, new Point(false, false))) + ); + } + + @Test + void move() { + assertThat(line.move(0)).isEqualTo(1); + } } diff --git a/src/test/java/nextstep/ladder/LinesTest.java b/src/test/java/nextstep/ladder/LinesTest.java deleted file mode 100644 index e7dc44ba49..0000000000 --- a/src/test/java/nextstep/ladder/LinesTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package nextstep.ladder; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; - -import java.util.Arrays; - -import static org.assertj.core.api.Assertions.assertThat; - -public class LinesTest { - private static Lines lines; - -// @BeforeAll -// static void setUpBeforeClass() { -// lines = new Lines(6, 5); -// } - - @BeforeEach - void setUp() { -// lines = new Lines(6, 5); - lines = new Lines( - Arrays.asList( - new Line(new Points(Arrays.asList(new Point(false, false), new Point(false, true), new Point(true, false), new Point(false, true), new Point(true, false)))), - new Line(new Points(Arrays.asList(new Point(false, true), new Point(true, false), new Point(false, false), new Point(false, false), new Point(false, false)))), - new Line(new Points(Arrays.asList(new Point(false, true), new Point(true, false), new Point(false, false), new Point(false, true), new Point(true, false)))), - new Line(new Points(Arrays.asList(new Point(false, true), new Point(true, false), new Point(false, true), new Point(true, false), new Point(false, false)))), - new Line(new Points(Arrays.asList(new Point(false, false), new Point(false, true), new Point(true, false), new Point(false, true), new Point(true, false)))), - new Line(new Points(Arrays.asList(new Point(false, false), new Point(false, false), new Point(false, false), new Point(false, true), new Point(true, false)))) - ) - ); - } - -// @Test -// @DisplayName("사다리 전체 출력 확인") -// void check() { -// for (Line line : lines.getValues()) { -// System.out.println(line.toString()); -// System.out.println(line.getResultIndexs()); -// } -// System.out.println(lines.toString("-----", " ")); -// } - - @Test - @DisplayName("사다리 라인 사이즈 확인") - void size() { - assertThat(lines.getValues()).hasSize(6); - } -} diff --git a/src/test/java/nextstep/ladder/PointTest.java b/src/test/java/nextstep/ladder/PointTest.java index f72eb3d4f5..43ee94e073 100644 --- a/src/test/java/nextstep/ladder/PointTest.java +++ b/src/test/java/nextstep/ladder/PointTest.java @@ -3,18 +3,54 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import java.util.Random; + import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; public class PointTest { private Point point; + private static final Random RANDOM = new Random(); + @BeforeEach void setUp() { point = new Point(false, true); } @Test - void 결과_인덱스_조회() { - assertThat(point.getResultIndex(0)).isEqualTo(1); + void 움직인_결과_조회__오른쪽() { + Point point = Point.first(true); + assertThat(point.move()).isEqualTo(Direction.RIGHT); + } + + @Test + void 움직인_결과_조회__왼쪽() { + Point point = Point.first(true).next(false); + assertThat(point.move()).isEqualTo(Direction.LEFT); + } + + @Test + void 움직인_결과_조회__아래() { + Point point = Point.first(true).next(false).last(); + assertThat(point.move()).isEqualTo(Direction.DOWN); } + + @Test + void 유효하지_않은_상태값() { + assertThatIllegalArgumentException().isThrownBy(() -> { + Point point = new Point(true, true); + }); + } + + @Test + void test() { + Point point = Point.first(RANDOM.nextBoolean()); + System.out.println(point); + Point point2 = point.next(RANDOM.nextBoolean()); + System.out.println(point2); + Point point3 = point2.last(); + System.out.println(point3); + } + } diff --git a/src/test/java/nextstep/ladder/PointsTest.java b/src/test/java/nextstep/ladder/PointsTest.java deleted file mode 100644 index ce025545cc..0000000000 --- a/src/test/java/nextstep/ladder/PointsTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package nextstep.ladder; - -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; - -import java.util.Arrays; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PointsTest { - private Points points; - - @Test - @DisplayName("생성된 Points 사이즈 확인") - void size() { - points = new Points(5); - assertThat(points.size()).isEqualTo(5); - } - - @Test - void 결과_인덱스_목록_조회() { - points = new Points(List.of(new Point(false, false), new Point(false, true), new Point(true, false), new Point(false, true), new Point(true, false))); - assertThat(points.getResultIndex(3)).isEqualTo(4); - } -}