.setUserUuid(userUuid)
.setComponentUuid(componentDto.uuid())
.build(), dbSession);
- checkArgument(existingFavoriteOnComponent.isEmpty(), "Component '%s' is already a favorite", componentDto.getKey());
+ checkArgument(existingFavoriteOnComponent.isEmpty(), "Component '%s' (uuid: %s) is already a favorite", componentDto.getKey(), componentDto.uuid());
List<PropertyDto> existingFavorites = dbClient.propertiesDao().selectByKeyAndUserUuidAndComponentQualifier(dbSession, PROP_FAVORITE_KEY, userUuid, componentDto.qualifier());
if (existingFavorites.size() >= 100) {
.setComponentUuid(component.uuid())
.setUserUuid(userUuid),
userLogin, component.getKey(), component.name(), component.qualifier());
- checkArgument(result == 1, "Component '%s' is not a favorite", component.getKey());
+ checkArgument(result == 1, "Component '%s' (uuid: %s) is not a favorite", component.getKey(), component.uuid());
}
}
assertThatThrownBy(() -> underTest.add(dbSession, project, user.getUuid(), user.getLogin(), true))
.isInstanceOf(IllegalArgumentException.class)
- .hasMessage(String.format("Component '%s' is already a favorite", project.getKey()));
+ .hasMessage(String.format("Component '%s' (uuid: %s) is already a favorite", project.getKey(), project.uuid()));
}
private void assertFavorite(ComponentDto project, UserDto user) {
try {
formula.computeHierarchy(context);
} catch (RuntimeException e) {
- throw new IllegalStateException("Fail to compute " + formula.getMetric().getKey() + " on " + context.getComponent().getKey(), e);
+ throw new IllegalStateException("Fail to compute " + formula.getMetric().getKey() + " on "
+ + context.getComponent().getKey() + " (uuid: " + context.getComponent().uuid() + ")", e);
}
}
}
try {
formula.compute(context, issueCounter);
} catch (RuntimeException e) {
- throw new IllegalStateException("Fail to compute " + formula.getMetric().getKey() + " on " + context.getComponent().getKey(), e);
+ throw new IllegalStateException("Fail to compute " + formula.getMetric().getKey() + " on "
+ + context.getComponent().getKey() + " (uuid: " + context.getComponent().uuid() + ")", e);
}
}
}
int from = request.mandatoryParamAsInt(PARAM_FROM);
int to = MoreObjects.firstNonNull(request.paramAsInt(PARAM_TO), Integer.MAX_VALUE);
- Iterable<DbFileSources.Line> lines = checkFoundWithOptional(sourceService.getLines(dbSession, file.uuid(), from, to), "No source found for file '%s'", file.getKey());
+ Iterable<DbFileSources.Line> lines = checkFoundWithOptional(sourceService.getLines(dbSession, file.uuid(), from, to),
+ "No source found for file '%s' (uuid: %s)", file.getKey(), file.uuid());
try (JsonWriter json = response.newJsonWriter()) {
json.beginObject();
linesJsonWriter.writeSource(lines, json, periodDateSupplier);
Duplication duplication1 = duplications.get(0);
assertThat(duplication1.componentDto()).isEqualTo(file1);
assertThat(duplication1.componentDto().getKey()).isEqualTo(file1.getKey());
+ assertThat(duplication1.componentDto().branchUuid()).isEqualTo(branch.uuid());
assertThat(duplication1.from()).isEqualTo(31);
assertThat(duplication1.size()).isEqualTo(5);
Duplication duplication2 = duplications.get(1);
assertThat(duplication2.componentDto()).isEqualTo(file2);
assertThat(duplication2.componentDto().getKey()).isEqualTo(file2.getKey());
+ assertThat(duplication1.componentDto().branchUuid()).isEqualTo(branch.uuid());
assertThat(duplication2.from()).isEqualTo(20);
assertThat(duplication2.size()).isEqualTo(5);
}
Duplication duplication1 = duplications.get(0);
assertThat(duplication1.componentDto()).isEqualTo(file1);
assertThat(duplication1.componentDto().getKey()).isEqualTo(file1.getKey());
+ assertThat(duplication1.componentDto().branchUuid()).isEqualTo(pullRequest.uuid());
assertThat(duplication1.from()).isEqualTo(31);
assertThat(duplication1.size()).isEqualTo(5);
Duplication duplication2 = duplications.get(1);
assertThat(duplication2.componentDto()).isEqualTo(file2);
assertThat(duplication2.componentDto().getKey()).isEqualTo(file2.getKey());
+ assertThat(duplication1.componentDto().branchUuid()).isEqualTo(pullRequest.uuid());
assertThat(duplication2.from()).isEqualTo(20);
assertThat(duplication2.size()).isEqualTo(5);
}
@Test
public void fail_if_not_already_a_favorite() {
- insertProjectAndPermissions();
+ ComponentDto componentDto = insertProjectAndPermissions();
assertThatThrownBy(() -> call(PROJECT_KEY))
.isInstanceOf(IllegalArgumentException.class)
- .hasMessage("Component '" + PROJECT_KEY + "' is not a favorite");
+ .hasMessage("Component '" + PROJECT_KEY + "' (uuid: "+componentDto.uuid()+") is not a favorite");
}
@Test