Arik Hadas has uploaded a new change for review.

Change subject: webadmin: making RegexValidation testable
......................................................................

webadmin: making RegexValidation testable

This patch change the call to Regex#IsMatch(String,String,RegexOptions)
within RegexValidation with a call to Regex#IsMatch(String,String).

The problem is that Regex#IsMatch(String,String,RegexOptions) isn't
implmenented (throws NotImplementedException) in Regex class that is
located in compat project, thus classes that inherits RegexValidation
can't be tested with unit tests.

>From the UI perspective this patch doesn't change much because in the
Regex class of the UI (located in gwt-extension) the method
Regex#IsMatch(String,String) calls
Regex#IsMatch(String,String,RegexOptions) with RegexOptions.None.

Change-Id: Ib35b0b1a4b7a29902a65986e1ceadf231a9a8c50
Signed-off-by: Arik Hadas <aha...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/RegexValidation.java
1 file changed, 2 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/43/11843/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/RegexValidation.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/RegexValidation.java
index 92573b1..99d9d6e 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/RegexValidation.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/RegexValidation.java
@@ -1,7 +1,6 @@
 package org.ovirt.engine.ui.uicommonweb.validation;
 
 import org.ovirt.engine.core.compat.Regex;
-import org.ovirt.engine.core.compat.RegexOptions;
 
 @SuppressWarnings("unused")
 public class RegexValidation implements IValidation
@@ -81,8 +80,8 @@
 
         if (value != null
                 && value instanceof String
-                && (getIsNegate() ? Regex.IsMatch(value.toString(), 
getExpression(), RegexOptions.None)
-                        : !Regex.IsMatch(value.toString(), getExpression(), 
RegexOptions.None)))
+                && (getIsNegate() ? Regex.IsMatch(value.toString(), 
getExpression())
+                        : !Regex.IsMatch(value.toString(), getExpression())))
         {
             result.setSuccess(false);
             result.getReasons().add(getMessage());


--
To view, visit http://gerrit.ovirt.org/11843
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib35b0b1a4b7a29902a65986e1ceadf231a9a8c50
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <aha...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to