Martin Mucha has uploaded a new change for review. Change subject: core: add support of variableReplacements to ValidationResultBuilder ......................................................................
core: add support of variableReplacements to ValidationResultBuilder Change-Id: I3d931b52d97bbac855c17ac13ee3acbda0c0f6fe Signed-off-by: Martin Mucha <mmu...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ValidationResult.java 1 file changed, 12 insertions(+), 19 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/62/30662/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ValidationResult.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ValidationResult.java index a729cca..27cef78 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ValidationResult.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ValidationResult.java @@ -42,26 +42,19 @@ * * @param message * The validation failure message. - */ - public ValidationResult(VdcBllMessages message) { - if(message == null) { - throw new IllegalArgumentException("message must not be null"); - } - this.message = message; - } - - /** - * Validation result for failure with a given message. - * - * @param message - * The validation failure message. * @param variableReplacements * Replacements for variables that appear in the message, in syntax: "$var text" where $var is the * variable to be replaced, and the text is the replacement. */ public ValidationResult(VdcBllMessages message, String... variableReplacements) { - this(message); - this.variableReplacements = Collections.unmodifiableList(Arrays.asList(variableReplacements)); + if (message == null) { + throw new IllegalArgumentException("message must not be null"); + } + + this.message = message; + this.variableReplacements = variableReplacements == null + ? null : + Collections.unmodifiableList(Arrays.asList(variableReplacements)); } /** @@ -161,8 +154,8 @@ * The error we expect should the validation fail. * @return A helper object that returns the correct validation result depending on the condition. */ - public static ValidationResultBuilder failWith(VdcBllMessages expectedError) { - return new ValidationResultBuilder(expectedError); + public static ValidationResultBuilder failWith(VdcBllMessages expectedError, String... variableReplacements) { + return new ValidationResultBuilder(expectedError, variableReplacements); } /** @@ -172,8 +165,8 @@ private ValidationResult expectedValidation; - private ValidationResultBuilder(VdcBllMessages expectedError) { - expectedValidation = new ValidationResult(expectedError); + private ValidationResultBuilder(VdcBllMessages expectedError, String... variableReplacements) { + expectedValidation = new ValidationResult(expectedError, variableReplacements); } /** -- To view, visit http://gerrit.ovirt.org/30662 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3d931b52d97bbac855c17ac13ee3acbda0c0f6fe Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Mucha <mmu...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches