3 * Copyright (C) 2009-2016 SonarSource SA
4 * mailto:contact AT sonarsource DOT com
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 package org.sonar.server.computation.task.projectanalysis.step;
23 import java.util.Arrays;
24 import javax.annotation.Nullable;
25 import org.assertj.core.data.Offset;
26 import org.junit.Rule;
27 import org.junit.Test;
28 import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
29 import org.sonar.server.computation.task.projectanalysis.duplication.DuplicationRepositoryRule;
30 import org.sonar.server.computation.task.projectanalysis.duplication.TextBlock;
31 import org.sonar.server.computation.task.projectanalysis.measure.MeasureRepositoryRule;
32 import org.sonar.server.computation.task.projectanalysis.measure.MeasureVariations;
33 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepositoryRule;
34 import org.sonar.server.computation.task.projectanalysis.period.Period;
35 import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
36 import org.sonar.server.computation.task.projectanalysis.scm.Changeset;
37 import org.sonar.server.computation.task.projectanalysis.scm.ScmInfoRepositoryRule;
39 import static com.google.common.base.Preconditions.checkArgument;
40 import static org.assertj.core.api.Assertions.assertThat;
41 import static org.assertj.guava.api.Assertions.assertThat;
42 import static org.sonar.api.measures.CoreMetrics.NEW_BLOCKS_DUPLICATED;
43 import static org.sonar.api.measures.CoreMetrics.NEW_BLOCKS_DUPLICATED_KEY;
44 import static org.sonar.api.measures.CoreMetrics.NEW_DUPLICATED_LINES;
45 import static org.sonar.api.measures.CoreMetrics.NEW_DUPLICATED_LINES_DENSITY;
46 import static org.sonar.api.measures.CoreMetrics.NEW_DUPLICATED_LINES_DENSITY_KEY;
47 import static org.sonar.api.measures.CoreMetrics.NEW_DUPLICATED_LINES_KEY;
48 import static org.sonar.api.measures.CoreMetrics.NEW_LINES;
49 import static org.sonar.api.measures.CoreMetrics.NEW_LINES_KEY;
50 import static org.sonar.api.utils.DateUtils.parseDate;
51 import static org.sonar.server.computation.task.projectanalysis.component.Component.Type.DIRECTORY;
52 import static org.sonar.server.computation.task.projectanalysis.component.Component.Type.FILE;
53 import static org.sonar.server.computation.task.projectanalysis.component.Component.Type.MODULE;
54 import static org.sonar.server.computation.task.projectanalysis.component.Component.Type.PROJECT;
55 import static org.sonar.server.computation.task.projectanalysis.component.ReportComponent.builder;
57 public class NewSizeMeasuresStepTest {
59 private static final Offset<Double> DEFAULT_OFFSET = Offset.offset(0.1d);
61 private static final int ROOT_REF = 1;
62 private static final int MODULE_REF = 12;
63 private static final int SUB_MODULE_1_REF = 123;
64 private static final int SUB_MODULE_2_REF = 126;
65 private static final int DIRECTORY_REF = 1234;
66 private static final int DIRECTORY_2_REF = 1235;
67 private static final int FILE_1_REF = 12341;
68 private static final int FILE_2_REF = 12342;
69 private static final int FILE_3_REF = 1261;
70 private static final int FILE_4_REF = 1262;
71 private static final String SOME_FILE_KEY = "some file key";
74 public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule()
76 builder(PROJECT, ROOT_REF)
78 builder(MODULE, MODULE_REF)
80 builder(MODULE, SUB_MODULE_1_REF)
82 builder(DIRECTORY, DIRECTORY_REF)
84 builder(FILE, FILE_1_REF).build(),
85 builder(FILE, FILE_2_REF).build())
87 builder(DIRECTORY, DIRECTORY_2_REF).build())
89 builder(MODULE, SUB_MODULE_2_REF)
91 builder(FILE, FILE_3_REF).build(),
92 builder(FILE, FILE_4_REF).build())
98 public PeriodsHolderRule periodsHolder = new PeriodsHolderRule().setPeriods(
99 new Period(2, "mode_p_1", null, parseDate("2009-12-25").getTime(), "u1"),
100 new Period(5, "mode_p_5", null, parseDate("2011-02-18").getTime(), "u2"));
103 public ScmInfoRepositoryRule scmInfoRepository = new ScmInfoRepositoryRule();
106 public MetricRepositoryRule metricRepository = new MetricRepositoryRule()
108 .add(NEW_DUPLICATED_LINES)
109 .add(NEW_DUPLICATED_LINES_DENSITY)
110 .add(NEW_BLOCKS_DUPLICATED);
113 public MeasureRepositoryRule measureRepository = MeasureRepositoryRule.create(treeRootHolder, metricRepository);
116 public DuplicationRepositoryRule duplicationRepository = DuplicationRepositoryRule.create(treeRootHolder);
118 NewSizeMeasuresStep underTest = new NewSizeMeasuresStep(treeRootHolder, periodsHolder, metricRepository, measureRepository, scmInfoRepository,
119 duplicationRepository);
122 public void compute_new_lines() {
123 setChangesets(FILE_1_REF, FILE_2_REF, FILE_4_REF);
127 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_1_REF, NEW_LINES_KEY, 11);
128 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_2_REF, NEW_LINES_KEY, 11);
129 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_3_REF, NEW_LINES_KEY, 0);
130 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_4_REF, NEW_LINES_KEY, 11);
131 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(DIRECTORY_REF, NEW_LINES_KEY, 22);
132 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(DIRECTORY_2_REF, NEW_LINES_KEY, 0);
133 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(SUB_MODULE_1_REF, NEW_LINES_KEY, 22);
134 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(SUB_MODULE_2_REF, NEW_LINES_KEY, 11);
135 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(MODULE_REF, NEW_LINES_KEY, 33);
136 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(ROOT_REF, NEW_LINES_KEY, 33);
140 public void compute_new_lines_with_no_changeset() {
143 assertComputedAndAggregatedToZeroInt(NEW_LINES_KEY);
147 public void compute_new_lines_with_no_ncloc_data() {
150 assertComputedAndAggregatedToZeroInt(NEW_LINES_KEY);
154 public void compute_duplicated_lines_counts_lines_from_original_and_InnerDuplicate_of_a_single_line() {
155 duplicationRepository.addDuplication(FILE_1_REF, new TextBlock(1, 1), new TextBlock(2, 2));
156 setChangesets(FILE_1_REF);
160 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_1_REF, NEW_DUPLICATED_LINES_KEY, 2d);
164 public void compute_duplicated_lines_counts_lines_from_original_and_ignores_InProjectDuplicate() {
165 TextBlock original = new TextBlock(1, 1);
166 duplicationRepository.addDuplication(FILE_1_REF, original, FILE_2_REF, new TextBlock(2, 2));
167 setChangesets(FILE_1_REF);
171 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_1_REF, NEW_DUPLICATED_LINES_KEY, 1d);
175 public void compute_duplicated_lines_counts_lines_from_original_and_ignores_CrossProjectDuplicate() {
176 TextBlock original = new TextBlock(1, 1);
177 duplicationRepository.addDuplication(FILE_1_REF, original, SOME_FILE_KEY, new TextBlock(2, 2));
178 setChangesets(FILE_1_REF);
182 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_1_REF, NEW_DUPLICATED_LINES_KEY, 1d);
186 public void compute_duplicated_lines_counts_lines_from_original_and_InnerDuplicate() {
187 TextBlock original = new TextBlock(1, 5);
188 duplicationRepository.addDuplication(FILE_1_REF, original, new TextBlock(10, 11));
189 setChangesets(FILE_1_REF);
193 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_1_REF, NEW_DUPLICATED_LINES_KEY, 6d);
197 public void compute_duplicated_lines_counts_lines_from_original_and_InnerDuplicate_only_once() {
198 TextBlock original = new TextBlock(1, 10);
199 duplicationRepository.addDuplication(FILE_1_REF, original, new TextBlock(10, 11), new TextBlock(11, 12));
200 duplicationRepository.addDuplication(FILE_1_REF, new TextBlock(2, 2), new TextBlock(4, 4));
201 setChangesets(FILE_1_REF);
205 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_1_REF, NEW_DUPLICATED_LINES_KEY, 11d);
209 public void compute_new_duplicated_lines_on_different_periods() {
210 TextBlock original = new TextBlock(1, 1);
211 duplicationRepository.addDuplication(FILE_1_REF, original, new TextBlock(2, 2));
212 scmInfoRepository.setScmInfo(FILE_1_REF,
213 Changeset.newChangesetBuilder().setDate(parseDate("2012-01-01").getTime()).setRevision("rev-1").build(),
214 Changeset.newChangesetBuilder().setDate(parseDate("2011-01-01").getTime()).setRevision("rev-2").build());
218 assertRawMeasureValue(FILE_1_REF, NEW_DUPLICATED_LINES_KEY, 2d, 1d);
222 public void compute_and_aggregate_duplicated_lines() {
223 addDuplicatedBlock(FILE_1_REF, 2);
224 addDuplicatedBlock(FILE_3_REF, 10);
225 addDuplicatedBlock(FILE_4_REF, 12);
226 setChangesets(FILE_1_REF);
227 setChangesets(FILE_2_REF);
228 setChangesets(FILE_3_REF);
229 setChangesets(FILE_4_REF);
233 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_1_REF, NEW_DUPLICATED_LINES_KEY, 2d);
234 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_2_REF, NEW_DUPLICATED_LINES_KEY, 0d);
235 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_3_REF, NEW_DUPLICATED_LINES_KEY, 9d);
236 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_4_REF, NEW_DUPLICATED_LINES_KEY, 11d);
237 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(DIRECTORY_REF, NEW_DUPLICATED_LINES_KEY, 2d);
238 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(DIRECTORY_2_REF, NEW_DUPLICATED_LINES_KEY, 0d);
239 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(SUB_MODULE_1_REF, NEW_DUPLICATED_LINES_KEY, 2d);
240 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(SUB_MODULE_2_REF, NEW_DUPLICATED_LINES_KEY, 20d);
241 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(MODULE_REF, NEW_DUPLICATED_LINES_KEY, 22d);
242 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(ROOT_REF, NEW_DUPLICATED_LINES_KEY, 22d);
246 public void compute_and_aggregate_zero_duplicated_line_when_no_duplication() {
247 setChangesets(FILE_1_REF);
248 setChangesets(FILE_2_REF);
249 setChangesets(FILE_3_REF);
250 setChangesets(FILE_4_REF);
254 assertComputedAndAggregatedToZeroInt(NEW_DUPLICATED_LINES_KEY);
258 public void compute_duplicated_blocks_one_for_original_one_for_each_InnerDuplicate() {
259 TextBlock original = new TextBlock(1, 1);
260 duplicationRepository.addDuplication(FILE_1_REF, original, new TextBlock(2, 2), new TextBlock(4, 4), new TextBlock(3, 4));
261 setChangesets(FILE_1_REF);
265 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_1_REF, NEW_BLOCKS_DUPLICATED_KEY, 4);
269 public void compute_duplicated_blocks_does_not_count_blocks_only_once_it_assumes_consistency_from_duplication_data() {
270 duplicationRepository.addDuplication(FILE_1_REF, new TextBlock(1, 1), new TextBlock(4, 4));
271 duplicationRepository.addDuplication(FILE_1_REF, new TextBlock(2, 2), new TextBlock(4, 4));
272 setChangesets(FILE_1_REF);
276 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_1_REF, NEW_BLOCKS_DUPLICATED_KEY, 4);
280 public void compute_duplicated_blocks_one_for_original_and_ignores_InProjectDuplicate() {
281 duplicationRepository.addDuplication(FILE_1_REF, new TextBlock(1, 1), FILE_2_REF, new TextBlock(2, 2));
282 setChangesets(FILE_1_REF);
286 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_1_REF, NEW_BLOCKS_DUPLICATED_KEY, 1);
290 public void compute_duplicated_blocks_one_for_original_and_ignores_CrossProjectDuplicate() {
291 duplicationRepository.addDuplication(FILE_1_REF, new TextBlock(1, 1), SOME_FILE_KEY, new TextBlock(2, 2));
292 setChangesets(FILE_1_REF);
296 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_1_REF, NEW_BLOCKS_DUPLICATED_KEY, 1);
300 public void compute_and_aggregate_duplicated_blocks_from_single_duplication() {
301 addDuplicatedBlock(FILE_1_REF, 11);
302 addDuplicatedBlock(FILE_2_REF, 2);
303 addDuplicatedBlock(FILE_4_REF, 7);
304 setChangesets(FILE_1_REF, FILE_2_REF, FILE_3_REF, FILE_4_REF);
308 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_1_REF, NEW_BLOCKS_DUPLICATED_KEY, 10);
309 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_2_REF, NEW_BLOCKS_DUPLICATED_KEY, 2);
310 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_3_REF, NEW_BLOCKS_DUPLICATED_KEY, 0);
311 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_4_REF, NEW_BLOCKS_DUPLICATED_KEY, 6);
312 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(DIRECTORY_REF, NEW_BLOCKS_DUPLICATED_KEY, 12);
313 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(SUB_MODULE_1_REF, NEW_BLOCKS_DUPLICATED_KEY, 12);
314 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(SUB_MODULE_2_REF, NEW_BLOCKS_DUPLICATED_KEY, 6);
315 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(MODULE_REF, NEW_BLOCKS_DUPLICATED_KEY, 18);
316 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(ROOT_REF, NEW_BLOCKS_DUPLICATED_KEY, 18);
320 public void compute_and_aggregate_duplicated_blocks_to_zero_when_no_duplication() {
321 setChangesets(FILE_1_REF, FILE_2_REF, FILE_3_REF, FILE_4_REF);
325 assertComputedAndAggregatedToZeroInt(NEW_BLOCKS_DUPLICATED_KEY);
329 public void compute_new_duplicated_lines_density() {
330 setChangesets(FILE_1_REF, FILE_2_REF, FILE_4_REF);
331 addDuplicatedBlock(FILE_1_REF, 2);
332 addDuplicatedBlock(FILE_3_REF, 10);
333 addDuplicatedBlock(FILE_4_REF, 12);
337 assertRawMeasureValue(FILE_1_REF, NEW_DUPLICATED_LINES_DENSITY_KEY, 18.2d, null);
338 assertRawMeasureValue(FILE_2_REF, NEW_DUPLICATED_LINES_DENSITY_KEY, 0d, null);
339 assertNoRawMeasure(FILE_3_REF, NEW_DUPLICATED_LINES_DENSITY_KEY);
340 assertRawMeasureValue(FILE_4_REF, NEW_DUPLICATED_LINES_DENSITY_KEY, 100d, null);
341 assertRawMeasureValue(DIRECTORY_REF, NEW_DUPLICATED_LINES_DENSITY_KEY, 9.1d, null);
342 assertNoRawMeasure(DIRECTORY_2_REF, NEW_DUPLICATED_LINES_DENSITY_KEY);
343 assertRawMeasureValue(SUB_MODULE_1_REF, NEW_DUPLICATED_LINES_DENSITY_KEY, 9.1d, null);
344 assertRawMeasureValue(SUB_MODULE_2_REF, NEW_DUPLICATED_LINES_DENSITY_KEY, 100d, null);
345 assertRawMeasureValue(MODULE_REF, NEW_DUPLICATED_LINES_DENSITY_KEY, 39.4d, null);
346 assertRawMeasureValue(ROOT_REF, NEW_DUPLICATED_LINES_DENSITY_KEY, 39.4d, null);
350 public void compute_no_new_duplicated_lines_density_when_no_lines() {
353 assertNoRawMeasures(NEW_DUPLICATED_LINES_DENSITY_KEY);
357 * Adds duplication blocks of a single line (each line is specific to its block).
359 * This is a very simple use case, convenient for unit tests but more realistic and complex use cases must be tested separately.
361 private void addDuplicatedBlock(int fileRef, int blockCount) {
362 checkArgument(blockCount > 1, "BlockCount can not be less than 2");
363 TextBlock original = new TextBlock(1, 1);
364 TextBlock[] duplicates = new TextBlock[blockCount - 1];
365 for (int i = 2; i < blockCount + 1; i++) {
366 duplicates[i - 2] = new TextBlock(i, i);
368 duplicationRepository.addDuplication(fileRef, original, duplicates);
371 private void setChangesets(int... componentRefs) {
372 Arrays.stream(componentRefs)
373 .forEach(componentRef -> scmInfoRepository.setScmInfo(componentRef,
374 Changeset.newChangesetBuilder().setDate(parseDate("2011-01-01").getTime()).setRevision("rev-1").build(),
375 Changeset.newChangesetBuilder().setDate(parseDate("2011-01-01").getTime()).setRevision("rev-1").build(),
376 // line 3 is older, part of no period
377 Changeset.newChangesetBuilder().setDate(parseDate("2007-01-15").getTime()).setRevision("rev-2").build(),
378 Changeset.newChangesetBuilder().setDate(parseDate("2011-01-01").getTime()).setRevision("rev-1").build(),
379 Changeset.newChangesetBuilder().setDate(parseDate("2011-01-01").getTime()).setRevision("rev-1").build(),
380 Changeset.newChangesetBuilder().setDate(parseDate("2011-01-01").getTime()).setRevision("rev-1").build(),
381 Changeset.newChangesetBuilder().setDate(parseDate("2011-01-01").getTime()).setRevision("rev-1").build(),
382 Changeset.newChangesetBuilder().setDate(parseDate("2011-01-01").getTime()).setRevision("rev-1").build(),
383 Changeset.newChangesetBuilder().setDate(parseDate("2011-01-01").getTime()).setRevision("rev-1").build(),
384 Changeset.newChangesetBuilder().setDate(parseDate("2011-01-01").getTime()).setRevision("rev-1").build(),
385 Changeset.newChangesetBuilder().setDate(parseDate("2011-01-01").getTime()).setRevision("rev-1").build(),
386 Changeset.newChangesetBuilder().setDate(parseDate("2011-01-01").getTime()).setRevision("rev-1").build()));
389 private void assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(int componentRef, String metricKey, double period2Value) {
390 assertRawMeasureValue(componentRef, metricKey, period2Value, 0d);
393 private void assertRawMeasureValue(int componentRef, String metricKey, double period2Value, @Nullable Double period5Value) {
394 MeasureVariations variations = measureRepository.getAddedRawMeasure(componentRef, metricKey).get().getVariations();
395 assertThat(variations.getVariation2()).isEqualTo(period2Value, DEFAULT_OFFSET);
396 if (period5Value != null) {
397 assertThat(variations.getVariation5()).isEqualTo(period5Value, DEFAULT_OFFSET);
399 assertThat(variations.hasVariation5()).isFalse();
403 private void assertComputedAndAggregatedToZeroInt(String metricKey) {
404 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_1_REF, metricKey, 0);
405 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_2_REF, metricKey, 0);
406 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_3_REF, metricKey, 0);
407 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(FILE_4_REF, metricKey, 0);
408 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(DIRECTORY_REF, metricKey, 0);
409 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(SUB_MODULE_1_REF, metricKey, 0);
410 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(SUB_MODULE_2_REF, metricKey, 0);
411 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(MODULE_REF, metricKey, 0);
412 assertRawMeasureValueOnPeriod2AndZeroOnPeriod5(ROOT_REF, metricKey, 0);
415 private void assertNoRawMeasure(int componentRef, String metricKey) {
416 assertThat(measureRepository.getAddedRawMeasure(componentRef, metricKey)).isAbsent();
419 private void assertNoRawMeasures(String metricKey) {
420 assertThat(measureRepository.getAddedRawMeasures(FILE_1_REF).get(metricKey)).isEmpty();
421 assertThat(measureRepository.getAddedRawMeasures(FILE_2_REF).get(metricKey)).isEmpty();
422 assertThat(measureRepository.getAddedRawMeasures(FILE_3_REF).get(metricKey)).isEmpty();
423 assertThat(measureRepository.getAddedRawMeasures(FILE_4_REF).get(metricKey)).isEmpty();
424 assertThat(measureRepository.getAddedRawMeasures(DIRECTORY_REF).get(metricKey)).isEmpty();
425 assertThat(measureRepository.getAddedRawMeasures(SUB_MODULE_1_REF).get(metricKey)).isEmpty();
426 assertThat(measureRepository.getAddedRawMeasures(SUB_MODULE_2_REF).get(metricKey)).isEmpty();
427 assertThat(measureRepository.getAddedRawMeasures(MODULE_REF).get(metricKey)).isEmpty();
428 assertThat(measureRepository.getAddedRawMeasures(ROOT_REF).get(metricKey)).isEmpty();