use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method createWithCopyAllScoresIfNoChange.
@Test
public void createWithCopyAllScoresIfNoChange() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
input.copyAllScoresIfNoChange = true;
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("foo").create(input).get();
assertThat(createdLabel.copyAllScoresIfNoChange).isTrue();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method createWithoutCopyAllScoresIfListOfFilesDidNotChange.
@Test
public void createWithoutCopyAllScoresIfListOfFilesDidNotChange() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
input.copyAllScoresIfListOfFilesDidNotChange = false;
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("foo").create(input).get();
assertThat(createdLabel.copyAllScoresIfListOfFilesDidNotChange).isNull();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method createWithoutAllowPostSubmit.
@Test
public void createWithoutAllowPostSubmit() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
input.allowPostSubmit = false;
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("foo").create(input).get();
assertThat(createdLabel.allowPostSubmit).isNull();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method valuesAndDescriptionsAreTrimmed.
@Test
public void valuesAndDescriptionsAreTrimmed() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
// Positive values can be specified as '<value>' or '+<value>'.
input.values = ImmutableMap.of(" 2 ", " Looks Very Good ", " +1 ", " Looks Good ", " 0 ", " Don't Know ", " -1 ", " Looks Bad ", " -2 ", " Looks Very Bad ");
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("Foo").create(input).get();
assertThat(createdLabel.values).containsExactly("+2", "Looks Very Good", "+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad", "-2", "Looks Very Bad");
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method cannotCreateLabelIfNameDoesntMatch.
@Test
public void cannotCreateLabelIfNameDoesntMatch() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.name = "Foo";
BadRequestException thrown = assertThrows(BadRequestException.class, () -> gApi.projects().name(project.get()).label("Bar").create(input));
assertThat(thrown).hasMessageThat().contains("name in input must match name in URL");
}
Aggregations