Conversation
|
파일이 없네요 확인부탁드립니다. :) |
업로드 하였습니다 :) |
README.md
Outdated
| * X X Y G X | ||
|
|
||
| * 입력 : h e l l o | ||
| * |
src/main/java/domain/Word.java
Outdated
| return result; | ||
| } | ||
|
|
||
| private Color mapped(char answer, char input) { |
There was a problem hiding this comment.
메서드가 private라서 테스트를 안하신 것 같은데 Char를 클래스로 뽑아서 해당 메서드 테스트코드 추가 해도 좋을 것 같습니다.
There was a problem hiding this comment.
테스트가 가능하도록 Color 쪽으로 이동해 봤습니다.
| public static String[] readFromResource(String resourceName){ | ||
| URL txtUrl = IOUtils.class.getClassLoader().getResource(resourceName); | ||
| try { | ||
| List<String> words = Files.readAllLines(Paths.get(txtUrl.toURI())); |
There was a problem hiding this comment.
txtUrl.toURI()에서 NPE 가 발생할 수 있을 것 같습니다.
src/main/java/ui/IOUtils.java
Outdated
| URL txtUrl = IOUtils.class.getClassLoader().getResource(resourceName); | ||
| try { | ||
| List<String> words = Files.readAllLines(Paths.get(txtUrl.toURI())); | ||
| return words.toArray(new String[words.size()]); |
There was a problem hiding this comment.
toArray를 사용할 때 size를 0으로 주면 성능상 이점이 있습니다. 아래 참고하시면 좋을 것 같네요 :)
https://stackoverflow.com/questions/174093/toarraynew-myclass0-or-toarraynew-myclassmylist-size
|
|
||
| TryResult tryResult = new TryResult(); | ||
| int round = 0; | ||
| while (round++ < PLAY_ROUND && !tryResult.isFinished()) { |
There was a problem hiding this comment.
메서드 추출이나, 뭔가 경기를 종료시키는 다른게 있으면 좋을 것 같습니다.
src/main/java/ui/ResultView.java
Outdated
| } | ||
|
|
||
| public static void results(TryResult tryResult) { | ||
| List<List<Color>> results = tryResult.getResults(); |
src/test/java/WordleTest.java
Outdated
| } | ||
|
|
||
| @Test | ||
| void readFile() throws URISyntaxException, IOException { |
src/test/java/WordleTest.java
Outdated
| @@ -0,0 +1,35 @@ | |||
| import domain.Color; | |||
| import domain.Word; | |||
| import org.junit.jupiter.api.Assertions; | |||
src/test/java/WordsTest.java
Outdated
| Words words = new Words("aaaaa", "bbbbb"); | ||
|
|
||
| //when | ||
| Word answers = words.answer(LocalDate.of(2021, 6, 20)); |
There was a problem hiding this comment.
기존 날짜가 바뀌면 테스트코드가 깨지기도 할 것 같고, % 연산도 잘 동작하는지 이 테스트로만 부족해보이네요.
src/test/java/WordleTest.java
Outdated
| import java.util.Arrays; | ||
| import java.util.List; | ||
|
|
||
| public class WordleTest { |
There was a problem hiding this comment.
테스트가 조금 부족해보이기도하고, 각각의 기능들을 따로 테스트해도 좋을 것 같습니다.
There was a problem hiding this comment.
필요 없는 기능들 딴곳으로 이동 시키고 테스트 강화 하였습니다.
- 단어집 읽어올때 words 생성하도록 로직 변경 처리.


No description provided.