SourceSet { public Set<String> getResources(Difficulty difficulty) { if (difficulties.has(difficulty.toString())) { Type setType = new TypeToken<Set<String>>() { }.getType(); JsonElement element = difficulties.get(difficulty.toString()); return new Gson().fromJson(element, setType); } else { return Collections.emptySet(); } } SourceSet(String resourceFile); Set<String> getResources(Difficulty difficulty);  }
@Test void givenValidFile_givenValidDifficulty_shouldReturnList() throws FileNotFoundException { SourceSet sourceSet = new SourceSet("source-sets.json"); Set<String> dirs = sourceSet.getResources(Difficulty.NORMAL); assertTrue(dirs.contains("grey")); }
@Test void givenValidFile_givenInvalidDifficulty_shouldReturnEmptyList() throws FileNotFoundException { SourceSet sourceSet = new SourceSet("source-sets.json"); Set<String> dirs = sourceSet.getResources(Difficulty.HARD); assertEquals(0, dirs.size()); }