### Question:
ModuleAnalyser { public List<AnalyserModel.AnalysisResult> analyse(final List<Definition> definitions) { if (definitions.isEmpty()) { return new ArrayList<>(); } else { final Pair<AccessVisitor, List<Supplier<AnalyserModel.AnalysisResult>>> visitorAndAnalysis = visitorAndAnalysis( definitions); try { classParser.parse(root, visitorAndAnalysis.first); } catch (IOException e) { throw new AnalyserException(e); } return visitorAndAnalysis.second.stream().map(Supplier::get).collect(Collectors.toList()); } } ModuleAnalyser(final ClassParser classParser, final ClasspathRoot root, Optional<Integer> evidenceLimit,
            ModuleGraphFactory factory); List<AnalyserModel.AnalysisResult> analyse(final List<Definition> definitions);  }### Answer:
@Test @DisplayName("analyse if specification has one module and no rule") void testOneModule() { final Definition definition = looseBuilder.with($ -> $.modules = Collections.singletonList(MAIN)).build(); final AnalyserModel.AnalysisResult actual = testee(orgExamples, Optional.empty()).analyse(one(definition)) .get(0); assertThat(actual.moduleConnectionViolations.isEmpty()).isTrue(); assertThat(actual.evidenceBackedViolations.isEmpty()).isTrue(); assertThat(actual.metrics).isEqualTo(Collections.singletonList(met("Main", 0, 0))); }
@Test @DisplayName("fail if no module is provided") void testFailNoModule() { assertThrows(AnalyserException.class, () -> { final Definition definition = looseBuilder.build(); testee(orgExamples, Optional.empty()).analyse(one(definition)); }); }