use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method cannotCreateLabelWithInvalidName.
@Test
public void cannotCreateLabelWithInvalidName() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", "0", "Don't Know", "-1", "Looks Bad");
BadRequestException thrown = assertThrows(BadRequestException.class, () -> gApi.projects().name(project.get()).label("INVALID_NAME").create(input));
assertThat(thrown).hasMessageThat().contains("invalid name: INVALID_NAME");
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method cannotCreateLabelWithInvalidBranch.
@Test
public void cannotCreateLabelWithInvalidBranch() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", "0", "Don't Know", "-1", "Looks Bad");
input.branches = ImmutableList.of("refs heads master");
BadRequestException thrown = assertThrows(BadRequestException.class, () -> gApi.projects().name(project.get()).label("Foo").create(input));
assertThat(thrown).hasMessageThat().contains("invalid branch: refs heads master");
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method createWithoutIgnoreSelfApproval.
@Test
public void createWithoutIgnoreSelfApproval() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
input.ignoreSelfApproval = false;
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("foo").create(input).get();
assertThat(createdLabel.ignoreSelfApproval).isNull();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method cannotCreateLabelWithNameThatConflicts.
@Test
public void cannotCreateLabelWithNameThatConflicts() throws Exception {
ResourceConflictException thrown = assertThrows(ResourceConflictException.class, () -> gApi.projects().name(allProjects.get()).label("code-review").create(new LabelDefinitionInput()));
assertThat(thrown).hasMessageThat().contains("label code-review conflicts with existing label Code-Review");
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method createWithoutCopyAnyScore.
@Test
public void createWithoutCopyAnyScore() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
input.copyAnyScore = false;
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("foo").create(input).get();
assertThat(createdLabel.copyAnyScore).isNull();
}
Aggregations