Fix label test.
parent
740da238fa
commit
1059643b0f
|
@ -90,7 +90,7 @@ public class Label implements Serializable {
|
|||
return color;
|
||||
}
|
||||
|
||||
public void setColor(@NotNull String color) {
|
||||
public void setColor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class RestLabel {
|
|||
label.setTitle(title);
|
||||
}
|
||||
|
||||
public void setColor(@NotNull final String color) {
|
||||
public void setColor(final String color) {
|
||||
label.setColor(color);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,18 +63,13 @@ public class LabelValidator implements Validator {
|
|||
title,
|
||||
Constants.MAX_LABEL_NAME_LENGTH);
|
||||
|
||||
ValidatorUtils.rejectIfEmptyOrWhitespace(
|
||||
errors,
|
||||
"title",
|
||||
"Label title can not be empty",
|
||||
title);
|
||||
|
||||
final User user = com.wisemapping.security.Utils.getUser();
|
||||
assert user != null;
|
||||
|
||||
final Label foundLabel = service.getLabelByTitle(title, user);
|
||||
if (foundLabel != null) {
|
||||
errors.rejectValue("title", Messages.LABEL_TITLE_ALREADY_EXISTS);
|
||||
if (user != null && title != null) {
|
||||
final Label foundLabel = service.getLabelByTitle(title, user);
|
||||
if (foundLabel != null) {
|
||||
errors.rejectValue("title", Messages.LABEL_TITLE_ALREADY_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,14 +94,14 @@ public class RestLabelControllerTest {
|
|||
addNewLabel(requestHeaders, restTemplate, null, COLOR);
|
||||
fail("Wrong response");
|
||||
} catch (IllegalStateException e) {
|
||||
assertTrue(e.getMessage().contains("Required field cannot be left blank"));
|
||||
assertTrue(e.getMessage().contains("Required field cannot be left blank"), e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
addNewLabel(requestHeaders, restTemplate, "title12345", null);
|
||||
fail("Wrong response");
|
||||
} catch (IllegalStateException e) {
|
||||
assertTrue(e.getMessage().contains("Required field cannot be left blank"));
|
||||
assertTrue(e.getMessage().contains("Required field cannot be left blank"), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue