use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method createWithoutCopyMinScore.
@Test
public void createWithoutCopyMinScore() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
input.copyMinScore = false;
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("foo").create(input).get();
assertThat(createdLabel.copyMinScore).isNull();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method createWithNameAndValuesOnly.
@Test
public void createWithNameAndValuesOnly() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("Foo").create(input).get();
assertThat(createdLabel.name).isEqualTo("Foo");
assertThat(createdLabel.projectName).isEqualTo(project.get());
assertThat(createdLabel.function).isEqualTo(LabelFunction.MAX_WITH_BLOCK.getFunctionName());
assertThat(createdLabel.values).containsExactlyEntriesIn(input.values);
assertThat(createdLabel.defaultValue).isEqualTo(0);
assertThat(createdLabel.branches).isNull();
assertThat(createdLabel.canOverride).isTrue();
assertThat(createdLabel.copyAnyScore).isNull();
assertThat(createdLabel.copyMinScore).isNull();
assertThat(createdLabel.copyMaxScore).isNull();
assertThat(createdLabel.copyAllScoresIfListOfFilesDidNotChange).isNull();
assertThat(createdLabel.copyAllScoresIfNoChange).isTrue();
assertThat(createdLabel.copyAllScoresIfNoCodeChange).isNull();
assertThat(createdLabel.copyAllScoresOnTrivialRebase).isNull();
assertThat(createdLabel.copyAllScoresOnMergeFirstParentUpdate).isNull();
assertThat(createdLabel.copyValues).isNull();
assertThat(createdLabel.allowPostSubmit).isTrue();
assertThat(createdLabel.ignoreSelfApproval).isNull();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method createWithCopyAllScoresOnMergeFirstParentUpdate.
@Test
public void createWithCopyAllScoresOnMergeFirstParentUpdate() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
input.copyAllScoresOnMergeFirstParentUpdate = true;
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("foo").create(input).get();
assertThat(createdLabel.copyAllScoresOnMergeFirstParentUpdate).isTrue();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method createWithCopyAllScoresIfListOfFilesDidNotChange.
@Test
public void createWithCopyAllScoresIfListOfFilesDidNotChange() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
input.copyAllScoresIfListOfFilesDidNotChange = true;
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("foo").create(input).get();
assertThat(createdLabel.copyAllScoresIfListOfFilesDidNotChange).isTrue();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method cannotCreateLabelWithInvalidDefaultValue.
@Test
public void cannotCreateLabelWithInvalidDefaultValue() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", "0", "Don't Know", "-1", "Looks Bad");
input.defaultValue = 5;
BadRequestException thrown = assertThrows(BadRequestException.class, () -> gApi.projects().name(project.get()).label("Foo").create(input));
assertThat(thrown).hasMessageThat().contains("invalid default value: " + input.defaultValue);
}
Aggregations