@Test public void add_no_measure_on_module_without_file() { DumbComponent project = DumbComponent.builder(PROJECT, 1) .addChildren( DumbComponent.builder(MODULE, 11) .addChildren(DumbComponent.builder(DIRECTORY, 111).build()) .build(), DumbComponent.builder(MODULE, 12) .addChildren( DumbComponent.builder(DIRECTORY, 121) .addChildren(builder(Component.Type.FILE, 1211).build()) .build()) .build()) .build(); treeRootHolder.setRoot(project); measureRepository.addRawMeasure(1211, CoreMetrics.LINES_KEY, newMeasureBuilder().create(10)); sut.execute(); assertThat(toEntries(measureRepository.getNewRawMeasures(1))) .containsOnly(entryOf(CoreMetrics.NCLOC_KEY, newMeasureBuilder().create(10))); assertThat(measureRepository.getNewRawMeasures(11)).isEmpty(); assertThat(measureRepository.getNewRawMeasures(111)).isEmpty(); assertThat(toEntries(measureRepository.getNewRawMeasures(12))) .containsOnly(entryOf(CoreMetrics.NCLOC_KEY, newMeasureBuilder().create(10))); assertThat(toEntries(measureRepository.getNewRawMeasures(121))) .containsOnly(entryOf(CoreMetrics.NCLOC_KEY, newMeasureBuilder().create(10))); assertThat(toEntries(measureRepository.getNewRawMeasures(1211))) .containsOnly(entryOf(CoreMetrics.NCLOC_KEY, newMeasureBuilder().create(10))); }
@Test public void add_no_measure_when_no_file() { DumbComponent project = DumbComponent.builder(PROJECT, 1) .addChildren( DumbComponent.builder(MODULE, 11) .addChildren(DumbComponent.builder(DIRECTORY, 111).build()) .build()) .build(); treeRootHolder.setRoot(project); sut.execute(); assertThat(measureRepository.getNewRawMeasures(1)).isEmpty(); assertThat(measureRepository.getNewRawMeasures(11)).isEmpty(); assertThat(measureRepository.getNewRawMeasures(111)).isEmpty(); }