• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ljacqu / wordeval / 14552398690

19 Apr 2025 07:59PM UTC coverage: 52.924% (+2.3%) from 50.591%
14552398690

push

github

ljacqu
Write sanitizer tests that don't require the dictionary file

268 of 576 branches covered (46.53%)

1 of 2 new or added lines in 1 file covered. (50.0%)

36 existing lines in 9 files now uncovered.

724 of 1368 relevant lines covered (52.92%)

3.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

40.0
/src/main/java/ch/jalu/wordeval/runners/DictionaryProcessor.java
1
package ch.jalu.wordeval.runners;
2

3
import ch.jalu.wordeval.DataUtils;
4
import ch.jalu.wordeval.dictionary.Dictionary;
5
import ch.jalu.wordeval.dictionary.Word;
6
import ch.jalu.wordeval.dictionary.WordFactory;
7
import ch.jalu.wordeval.dictionary.sanitizer.Sanitizer;
8
import ch.jalu.wordeval.language.Language;
9
import org.apache.commons.lang3.StringUtils;
10

11
import java.util.ArrayList;
12
import java.util.List;
13

14
/**
15
 * Processes a dictionary.
16
 */
17
public final class DictionaryProcessor {
18

19
  private DictionaryProcessor() {
20
  }
21

22
  public static List<Word> readAllWords(Dictionary dictionary) {
NEW
23
    return processAllWords(dictionary, DataUtils.readAllLines(dictionary.getFile()));
×
24
  }
25

26
  public static List<Word> processAllWords(Dictionary dictionary, List<String> lines) {
27
    final Sanitizer sanitizer = dictionary.buildSanitizer();
3✔
28
    final Language language = dictionary.getLanguage();
3✔
29
    final WordFactory wordFactory = new WordFactory(language);
5✔
30

31
    return lines.stream()
5✔
32
        .map(sanitizer::isolateWord)
5✔
33
        .filter(StringUtils::isNotEmpty)
3✔
34
        .map(wordFactory::createWordObject)
4✔
35
        .toList();
1✔
36
  }
37

38
  public static WordEntries getSkippedLines(Dictionary dictionary) {
39
    final Sanitizer sanitizer = dictionary.buildSanitizer();
×
40
    List<String> skippedLines = new ArrayList<>();
×
41
    List<String> includedLines = new ArrayList<>();
×
42

43
    DataUtils.readAllLines(dictionary.getFile()).forEach(line -> {
×
44
      String isolatedWord = sanitizer.isolateWord(line);
×
45
      if (StringUtils.isEmpty(isolatedWord)) {
×
46
        skippedLines.add(line);
×
47
      } else {
48
        includedLines.add(isolatedWord + " -> " + line);
×
49
      }
50
    });
×
51

52
    return new WordEntries(skippedLines, includedLines);
×
53
  }
54

55
  public record WordEntries(List<String> skippedLines, List<String> includedLines) {
×
56
  }
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc