use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method cannotCreateLabelWithValuesThatHaveEmptyDescription.
@Test
public void cannotCreateLabelWithValuesThatHaveEmptyDescription() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "");
BadRequestException thrown = assertThrows(BadRequestException.class, () -> gApi.projects().name(project.get()).label("Foo").create(input));
assertThat(thrown).hasMessageThat().contains("description for value '+1' cannot be empty");
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method cannotCreateLabelWithUnknownFunction.
@Test
public void cannotCreateLabelWithUnknownFunction() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", "0", "Don't Know", "-1", "Looks Bad");
input.function = "UnknownFuction";
BadRequestException thrown = assertThrows(BadRequestException.class, () -> gApi.projects().name(project.get()).label("Foo").create(input));
assertThat(thrown).hasMessageThat().contains("unknown function: " + input.function);
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method createWithAllowPostSubmit.
@Test
public void createWithAllowPostSubmit() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
input.allowPostSubmit = true;
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("foo").create(input).get();
assertThat(createdLabel.allowPostSubmit).isTrue();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method createWithoutCopyAllScoresOnTrivialRebase.
@Test
public void createWithoutCopyAllScoresOnTrivialRebase() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
input.copyAllScoresOnTrivialRebase = false;
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("foo").create(input).get();
assertThat(createdLabel.copyAllScoresOnTrivialRebase).isNull();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method cannotCreateLabelWithoutValues.
@Test
public void cannotCreateLabelWithoutValues() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
BadRequestException thrown = assertThrows(BadRequestException.class, () -> gApi.projects().name(project.get()).label("Foo").create(input));
assertThat(thrown).hasMessageThat().contains("values are required");
input.values = ImmutableMap.of();
thrown = assertThrows(BadRequestException.class, () -> gApi.projects().name(project.get()).label("Foo").create(input));
assertThat(thrown).hasMessageThat().contains("values are required");
}
Aggregations