mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-24 23:17:56 +01:00
Fix label test.
This commit is contained in:
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
Block a user