tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [07/10] git commit: Revert "TAJO-1114: Improve ConfVars (SessionVar) to take a validator interface to check its input. (fixed compilation error)"
Date Tue, 28 Oct 2014 02:21:31 GMT
Revert "TAJO-1114: Improve ConfVars (SessionVar) to take a validator interface to check its
input. (fixed compilation error)"

This reverts commit 7a65763554e556498b6d52dd2685636c3b6584b3.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/58b8eb45
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/58b8eb45
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/58b8eb45

Branch: refs/heads/index_support
Commit: 58b8eb45c0ef39047fb1738c10e2411a8cc0dc5e
Parents: 1d63dca
Author: Hyunsik Choi <hyunsik@apache.org>
Authored: Mon Oct 27 18:16:56 2014 -0700
Committer: Hyunsik Choi <hyunsik@apache.org>
Committed: Mon Oct 27 18:16:56 2014 -0700

----------------------------------------------------------------------
 .../apache/tajo/validation/TestValidators.java  | 127 ++++++++++---------
 1 file changed, 65 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/58b8eb45/tajo-common/src/test/java/org/apache/tajo/validation/TestValidators.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/validation/TestValidators.java b/tajo-common/src/test/java/org/apache/tajo/validation/TestValidators.java
index 1da3591..dc4850c 100644
--- a/tajo-common/src/test/java/org/apache/tajo/validation/TestValidators.java
+++ b/tajo-common/src/test/java/org/apache/tajo/validation/TestValidators.java
@@ -18,7 +18,6 @@
 
 package org.apache.tajo.validation;
 
-import static org.hamcrest.CoreMatchers.hasItem;
 import static org.junit.Assert.*;
 import static org.hamcrest.CoreMatchers.*;
 
@@ -30,7 +29,6 @@ import java.util.Random;
 import java.util.UUID;
 
 import org.apache.tajo.util.TUtil;
-import org.hamcrest.CoreMatchers;
 import org.hamcrest.Description;
 import org.hamcrest.Matcher;
 import org.hamcrest.TypeSafeDiagnosingMatcher;
@@ -76,7 +74,7 @@ public class TestValidators {
     assertThat(new NotNullValidator().validateInternal(testValue), is(false));
     assertThat(new NotNullValidator().validate(testValue).size(), is(1));
     assertThat(new NotNullValidator().validate(testValue),
-        CoreMatchers.hasItem(hasAClass(equalTo(NotNullValidator.class))));
+        hasItem(hasAClass(equalTo(NotNullValidator.class))));
   }
 
   @Test
@@ -89,52 +87,55 @@ public class TestValidators {
     double doubleValue;
     BigInteger bigIntegerValue;
     BigDecimal bigDecimalValue;
-
-    Matcher<Iterable<? super ConstraintViolation>> matcher =  hasItem(hasAClass(equalTo(MinValidator.class)));
     
     byteValue = 2;
     assertThat(new MinValidator(Byte.toString(Byte.MIN_VALUE)).validateInternal(byteValue),
is(true));
     assertThat(new MinValidator(Byte.toString(Byte.MIN_VALUE)).validate(byteValue).size(),
is(0));
     assertThat(new MinValidator(Byte.toString(Byte.MAX_VALUE)).validateInternal(byteValue),
is(false));
     assertThat(new MinValidator(Byte.toString(Byte.MAX_VALUE)).validate(byteValue).size(),
is(1));
-    assertThat(new MinValidator(Byte.toString(Byte.MAX_VALUE)).validate(byteValue), matcher);
+    assertThat(new MinValidator(Byte.toString(Byte.MAX_VALUE)).validate(byteValue), 
+        hasItem(hasAClass(equalTo(MinValidator.class))));
     
     shortValue = 3;
     assertThat(new MinValidator(Short.toString(Short.MIN_VALUE)).validateInternal(shortValue),
is(true));
     assertThat(new MinValidator(Short.toString(Short.MIN_VALUE)).validate(shortValue).size(),
is(0));
     assertThat(new MinValidator(Short.toString(Short.MAX_VALUE)).validateInternal(shortValue),
is(false));
     assertThat(new MinValidator(Short.toString(Short.MAX_VALUE)).validate(shortValue).size(),
is(1));
-    assertThat(new MinValidator(Short.toString(Short.MAX_VALUE)).validate(shortValue), matcher);
+    assertThat(new MinValidator(Short.toString(Short.MAX_VALUE)).validate(shortValue),
+        hasItem(hasAClass(equalTo(MinValidator.class))));
     
     intValue = 4;
     assertThat(new MinValidator(Integer.toString(Integer.MIN_VALUE)).validateInternal(intValue),
is(true));
     assertThat(new MinValidator(Integer.toString(Integer.MIN_VALUE)).validate(intValue).size(),
is(0));
     assertThat(new MinValidator(Integer.toString(Integer.MAX_VALUE)).validateInternal(intValue),
is(false));
     assertThat(new MinValidator(Integer.toString(Integer.MAX_VALUE)).validate(intValue).size(),
is(1));
-    assertThat(new MinValidator(Integer.toString(Integer.MAX_VALUE)).validate(intValue),
matcher);
+    assertThat(new MinValidator(Integer.toString(Integer.MAX_VALUE)).validate(intValue),
+        hasItem(hasAClass(equalTo(MinValidator.class))));
     
     longValue = 5;
     assertThat(new MinValidator(Long.toString(Long.MIN_VALUE)).validateInternal(longValue),
is(true));
     assertThat(new MinValidator(Long.toString(Long.MIN_VALUE)).validate(longValue).size(),
is(0));
     assertThat(new MinValidator(Long.toString(Long.MAX_VALUE)).validateInternal(longValue),
is(false));
     assertThat(new MinValidator(Long.toString(Long.MAX_VALUE)).validate(longValue).size(),
is(1));
-    assertThat(new MinValidator(Long.toString(Long.MAX_VALUE)).validate(longValue), matcher);
+    assertThat(new MinValidator(Long.toString(Long.MAX_VALUE)).validate(longValue),
+        hasItem(hasAClass(equalTo(MinValidator.class))));
     
     floatValue = 4.7f;
     assertThat(new MinValidator(Float.toString(Float.MIN_VALUE)).validateInternal(floatValue),
is(true));
     assertThat(new MinValidator(Float.toString(Float.MIN_VALUE)).validate(floatValue).size(),
is(0));
     assertThat(new MinValidator(Float.toString(Float.MAX_VALUE)).validateInternal(floatValue),
is(false));
     assertThat(new MinValidator(Float.toString(Float.MAX_VALUE)).validate(floatValue).size(),
is(1));
-    assertThat(new MinValidator(Float.toString(Float.MAX_VALUE)).validate(floatValue), matcher);
+    assertThat(new MinValidator(Float.toString(Float.MAX_VALUE)).validate(floatValue),
+        hasItem(hasAClass(equalTo(MinValidator.class))));
     
     doubleValue = 7.5e10;
     assertThat(new MinValidator(Double.toString(Double.MIN_VALUE)).validateInternal(doubleValue),
is(true));
     assertThat(new MinValidator(Double.toString(Double.MIN_VALUE)).validate(doubleValue).size(),
is(0));
     assertThat(new MinValidator(Double.toString(Double.MAX_VALUE)).validateInternal(doubleValue),
is(false));
     assertThat(new MinValidator(Double.toString(Double.MAX_VALUE)).validate(doubleValue).size(),
is(1));
-    assertThat(new MinValidator(Double.toString(Double.MAX_VALUE)).validate(doubleValue),
matcher);
-
-
+    assertThat(new MinValidator(Double.toString(Double.MAX_VALUE)).validate(doubleValue),
+        hasItem(hasAClass(equalTo(MinValidator.class))));
+    
     bigIntegerValue = new BigInteger(10, new Random());
     assertThat(new MinValidator(new BigInteger(Long.toString(Long.MIN_VALUE)).toString(10))
       .validateInternal(bigIntegerValue), is(true));
@@ -145,7 +146,7 @@ public class TestValidators {
     assertThat(new MinValidator(new BigInteger(Long.toString(Long.MAX_VALUE)).toString(10))
       .validate(bigIntegerValue).size(), is(1));
     assertThat(new MinValidator(new BigInteger(Long.toString(Long.MAX_VALUE)).toString(10))
-      .validate(bigIntegerValue), matcher);
+      .validate(bigIntegerValue), hasItem(hasAClass(equalTo(MinValidator.class))));
     
     bigDecimalValue = new BigDecimal(new BigInteger(10, new Random()), MathContext.DECIMAL64);
     assertThat(new MinValidator(new BigDecimal(Double.MIN_VALUE).toString())
@@ -157,7 +158,7 @@ public class TestValidators {
     assertThat(new MinValidator(new BigDecimal(Double.MAX_VALUE).toString())
       .validate(bigDecimalValue).size(), is(1));
     assertThat(new MinValidator(new BigDecimal(Double.MAX_VALUE).toString())
-      .validate(bigDecimalValue), matcher);
+      .validate(bigDecimalValue), hasItem(hasAClass(equalTo(MinValidator.class))));
   }
   
   @Test
@@ -170,50 +171,54 @@ public class TestValidators {
     double doubleValue;
     BigInteger bigIntegerValue;
     BigDecimal bigDecimalValue;
-
-    Matcher<Iterable<? super ConstraintViolation>> matcher =  hasItem(hasAClass(equalTo(MaxValidator.class)));
-
+    
     byteValue = 2;
     assertThat(new MaxValidator(Byte.toString(Byte.MAX_VALUE)).validateInternal(byteValue),
is(true));
     assertThat(new MaxValidator(Byte.toString(Byte.MAX_VALUE)).validate(byteValue).size(),
is(0));
     assertThat(new MaxValidator(Byte.toString(Byte.MIN_VALUE)).validateInternal(byteValue),
is(false));
     assertThat(new MaxValidator(Byte.toString(Byte.MIN_VALUE)).validate(byteValue).size(),
is(1));
-    assertThat(new MaxValidator(Byte.toString(Byte.MIN_VALUE)).validate(byteValue), matcher);
+    assertThat(new MaxValidator(Byte.toString(Byte.MIN_VALUE)).validate(byteValue), 
+        hasItem(hasAClass(equalTo(MaxValidator.class))));
     
     shortValue = 3;
     assertThat(new MaxValidator(Short.toString(Short.MAX_VALUE)).validateInternal(shortValue),
is(true));
     assertThat(new MaxValidator(Short.toString(Short.MAX_VALUE)).validate(shortValue).size(),
is(0));
     assertThat(new MaxValidator(Short.toString(Short.MIN_VALUE)).validateInternal(shortValue),
is(false));
     assertThat(new MaxValidator(Short.toString(Short.MIN_VALUE)).validate(shortValue).size(),
is(1));
-    assertThat(new MaxValidator(Short.toString(Short.MIN_VALUE)).validate(shortValue), matcher);
+    assertThat(new MaxValidator(Short.toString(Short.MIN_VALUE)).validate(shortValue),
+        hasItem(hasAClass(equalTo(MaxValidator.class))));
     
     intValue = 4;
     assertThat(new MaxValidator(Integer.toString(Integer.MAX_VALUE)).validateInternal(intValue),
is(true));
     assertThat(new MaxValidator(Integer.toString(Integer.MAX_VALUE)).validate(intValue).size(),
is(0));
     assertThat(new MaxValidator(Integer.toString(Integer.MIN_VALUE)).validateInternal(intValue),
is(false));
     assertThat(new MaxValidator(Integer.toString(Integer.MIN_VALUE)).validate(intValue).size(),
is(1));
-    assertThat(new MaxValidator(Integer.toString(Integer.MIN_VALUE)).validate(intValue),
matcher);
+    assertThat(new MaxValidator(Integer.toString(Integer.MIN_VALUE)).validate(intValue),
+        hasItem(hasAClass(equalTo(MaxValidator.class))));
     
     longValue = 5;
     assertThat(new MaxValidator(Long.toString(Long.MAX_VALUE)).validateInternal(longValue),
is(true));
     assertThat(new MaxValidator(Long.toString(Long.MAX_VALUE)).validate(longValue).size(),
is(0));
     assertThat(new MaxValidator(Long.toString(Long.MIN_VALUE)).validateInternal(longValue),
is(false));
     assertThat(new MaxValidator(Long.toString(Long.MIN_VALUE)).validate(longValue).size(),
is(1));
-    assertThat(new MaxValidator(Long.toString(Long.MIN_VALUE)).validate(longValue), matcher);
+    assertThat(new MaxValidator(Long.toString(Long.MIN_VALUE)).validate(longValue),
+        hasItem(hasAClass(equalTo(MaxValidator.class))));
     
     floatValue = 4.7f;
     assertThat(new MaxValidator(Float.toString(Float.MAX_VALUE)).validateInternal(floatValue),
is(true));
     assertThat(new MaxValidator(Float.toString(Float.MAX_VALUE)).validate(floatValue).size(),
is(0));
     assertThat(new MaxValidator(Float.toString(Float.MIN_VALUE)).validateInternal(floatValue),
is(false));
     assertThat(new MaxValidator(Float.toString(Float.MIN_VALUE)).validate(floatValue).size(),
is(1));
-    assertThat(new MaxValidator(Float.toString(Float.MIN_VALUE)).validate(floatValue), matcher);
+    assertThat(new MaxValidator(Float.toString(Float.MIN_VALUE)).validate(floatValue),
+        hasItem(hasAClass(equalTo(MaxValidator.class))));
     
     doubleValue = 7.5e10;
     assertThat(new MaxValidator(Double.toString(Double.MAX_VALUE)).validateInternal(doubleValue),
is(true));
     assertThat(new MaxValidator(Double.toString(Double.MAX_VALUE)).validate(doubleValue).size(),
is(0));
     assertThat(new MaxValidator(Double.toString(Double.MIN_VALUE)).validateInternal(doubleValue),
is(false));
     assertThat(new MaxValidator(Double.toString(Double.MIN_VALUE)).validate(doubleValue).size(),
is(1));
-    assertThat(new MaxValidator(Double.toString(Double.MIN_VALUE)).validate(doubleValue),
matcher);
+    assertThat(new MaxValidator(Double.toString(Double.MIN_VALUE)).validate(doubleValue),
+        hasItem(hasAClass(equalTo(MaxValidator.class))));
     
     bigIntegerValue = new BigInteger(10, new Random());
     assertThat(new MaxValidator(new BigInteger(Long.toString(Long.MAX_VALUE)).toString(10))
@@ -224,8 +229,8 @@ public class TestValidators {
       .validateInternal(bigIntegerValue), is(false));
     assertThat(new MaxValidator(new BigInteger(Long.toString(Long.MIN_VALUE)).toString(10))
       .validate(bigIntegerValue).size(), is(1));
-    assertThat(new MaxValidator(new BigInteger(Long.toString(Long.MIN_VALUE)).toString(10)).validate(bigIntegerValue),
-        matcher);
+    assertThat(new MaxValidator(new BigInteger(Long.toString(Long.MIN_VALUE)).toString(10))
+      .validate(bigIntegerValue), hasItem(hasAClass(equalTo(MaxValidator.class))));
     
     bigDecimalValue = new BigDecimal(new BigInteger(10, new Random()), MathContext.DECIMAL64);
     assertThat(new MaxValidator(new BigDecimal(Double.MAX_VALUE).toString())
@@ -236,8 +241,8 @@ public class TestValidators {
       .validateInternal(bigDecimalValue), is(false));
     assertThat(new MaxValidator(new BigDecimal(Double.MIN_VALUE).toString())
       .validate(bigDecimalValue).size(), is(1));
-
-    assertThat(new MaxValidator(new BigDecimal(Double.MIN_VALUE).toString()).validate(bigDecimalValue),
matcher);
+    assertThat(new MaxValidator(new BigDecimal(Double.MIN_VALUE).toString())
+      .validate(bigDecimalValue), hasItem(hasAClass(equalTo(MaxValidator.class))));
   }
   
   @Test
@@ -247,9 +252,8 @@ public class TestValidators {
     assertThat(new PatternValidator("^([a-zA-Z])+://").validate(schemeString).size(), is(0));
     assertThat(new PatternValidator("([a-zA-Z])+://$").validateInternal(schemeString), is(false));
     assertThat(new PatternValidator("([a-zA-Z])+://$").validate(schemeString).size(), is(1));
-
-    Matcher<Iterable<? super ConstraintViolation>> matcher =  hasItem(hasAClass(equalTo(PatternValidator.class)));
-    assertThat(new PatternValidator("([a-zA-Z])+://$").validate(schemeString), matcher);
+    assertThat(new PatternValidator("([a-zA-Z])+://$").validate(schemeString),
+        hasItem(hasAClass(equalTo(PatternValidator.class))));
   }
   
   @Test
@@ -261,14 +265,15 @@ public class TestValidators {
     assertThat(new LengthValidator(10).validate(shortString).size(), is(0));
     assertThat(new LengthValidator(3).validateInternal(shortString), is(false));
     assertThat(new LengthValidator(3).validate(shortString).size(), is(1));
-    Matcher<Iterable<? super ConstraintViolation>> matcher =  hasItem(hasAClass(equalTo(LengthValidator.class)));
-    assertThat(new LengthValidator(3).validate(shortString), matcher);
+    assertThat(new LengthValidator(3).validate(shortString), 
+        hasItem(hasAClass(equalTo(LengthValidator.class))));
     
     assertThat(new LengthValidator(40).validateInternal(longString), is(true));
     assertThat(new LengthValidator(40).validate(longString).size(), is(0));
     assertThat(new LengthValidator(10).validateInternal(longString), is(false));
     assertThat(new LengthValidator(10).validate(longString).size(), is(1));
-    assertThat(new LengthValidator(10).validate(longString), matcher);
+    assertThat(new LengthValidator(10).validate(longString), 
+        hasItem(hasAClass(equalTo(LengthValidator.class))));
   }
   
   @Test
@@ -281,16 +286,15 @@ public class TestValidators {
     validators.add(new LengthValidator(255));
     assertThat(new GroupValidator(validators).validate(httpUrl).size(), is(0));
     assertThat(new GroupValidator(validators).validate("tajo").size(), is(1));
-    Matcher<Iterable<? super ConstraintViolation>> matcher1 =  hasItem(hasAClass(equalTo(PatternValidator.class)));
-    assertThat(new GroupValidator(validators).validate("tajo"),  matcher1);
+    assertThat(new GroupValidator(validators).validate("tajo"),
+        hasItem(hasAClass(equalTo(PatternValidator.class))));
     
     validators = TUtil.newHashSet();
     validators.add(new PatternValidator("^[a-zA-Z]+://"));
     validators.add(new LengthValidator(7));
     assertThat(new GroupValidator(validators).validate(httpUrl).size(), is(1));
-
-    Matcher<Iterable<? super ConstraintViolation>> matcher2 =  hasItem(hasAClass(equalTo(LengthValidator.class)));
-    assertThat(new GroupValidator(validators).validate(httpUrl), matcher2);
+    assertThat(new GroupValidator(validators).validate(httpUrl),
+        hasItem(hasAClass(equalTo(LengthValidator.class))));
   }
   
   @Test
@@ -343,14 +347,14 @@ public class TestValidators {
     String invalidUrl = "t!ef:///tmp/tajo-root";
     assertThat(new PathValidator().validateInternal(invalidUrl), is(false));
     assertThat(new PathValidator().validate(invalidUrl).size(), is(1));
-
-    Matcher<Iterable<? super ConstraintViolation>> matcher =  hasItem(hasAClass(equalTo(PathValidator.class)));
-    assertThat(new PathValidator().validate(invalidUrl), matcher);
+    assertThat(new PathValidator().validate(invalidUrl),
+        hasItem(hasAClass(equalTo(PathValidator.class))));
     
     invalidUrl = "This is not a valid url.";
     assertThat(new PathValidator().validateInternal(invalidUrl), is(false));
     assertThat(new PathValidator().validate(invalidUrl).size(), is(1));
-    assertThat(new PathValidator().validate(invalidUrl), matcher);
+    assertThat(new PathValidator().validate(invalidUrl),
+        hasItem(hasAClass(equalTo(PathValidator.class))));
   }
   
   @Test
@@ -370,9 +374,8 @@ public class TestValidators {
     String invalidVariable = "Invalid Shell Variable Name";
     assertThat(new ShellVariableValidator().validateInternal(invalidVariable), is(false));
     assertThat(new ShellVariableValidator().validate(invalidVariable).size(), is(1));
-
-    Matcher<Iterable<? super ConstraintViolation>> matcher =  hasItem(hasAClass(equalTo(ShellVariableValidator.class)));
-    assertThat(new ShellVariableValidator().validate(invalidVariable), matcher);
+    assertThat(new ShellVariableValidator().validate(invalidVariable),
+        hasItem(hasAClass(equalTo(ShellVariableValidator.class))));
   }
   
   @Test
@@ -412,19 +415,20 @@ public class TestValidators {
     String invalidNetAddr = "5000";
     assertThat(new NetworkAddressValidator().validateInternal(invalidNetAddr), is(false));
     assertThat(new NetworkAddressValidator().validate(invalidNetAddr).size(), is(1));
-
-    Matcher<Iterable<? super ConstraintViolation>> matcher = hasItem(hasAClass(equalTo(NetworkAddressValidator.class)));
-    assertThat(new NetworkAddressValidator().validate(invalidNetAddr), matcher);
+    assertThat(new NetworkAddressValidator().validate(invalidNetAddr),
+        hasItem(hasAClass(equalTo(NetworkAddressValidator.class))));
     
     invalidNetAddr = "192.168.:";
     assertThat(new NetworkAddressValidator().validateInternal(invalidNetAddr), is(false));
     assertThat(new NetworkAddressValidator().validate(invalidNetAddr).size(), is(1));
-    assertThat(new NetworkAddressValidator().validate(invalidNetAddr), matcher);
+    assertThat(new NetworkAddressValidator().validate(invalidNetAddr),
+        hasItem(hasAClass(equalTo(NetworkAddressValidator.class))));
     
     invalidNetAddr = "localhost:98765";
     assertThat(new NetworkAddressValidator().validateInternal(invalidNetAddr), is(false));
     assertThat(new NetworkAddressValidator().validate(invalidNetAddr).size(), is(1));
-    assertThat(new NetworkAddressValidator().validate(invalidNetAddr), matcher);
+    assertThat(new NetworkAddressValidator().validate(invalidNetAddr),
+        hasItem(hasAClass(equalTo(NetworkAddressValidator.class))));
   }
   
   @Test
@@ -446,19 +450,20 @@ public class TestValidators {
     String invalidBoolean = "yes";
     assertThat(new BooleanValidator().validateInternal(invalidBoolean), is(false));
     assertThat(new BooleanValidator().validate(invalidBoolean).size(), is(1));
-
-    Matcher<Iterable<? super ConstraintViolation>> matcher = hasItem(hasAClass(equalTo(BooleanValidator.class)));
-    assertThat(new BooleanValidator().validate(invalidBoolean), matcher);
+    assertThat(new BooleanValidator().validate(invalidBoolean), 
+        hasItem(hasAClass(equalTo(BooleanValidator.class))));
     
     invalidBoolean = "nope";
     assertThat(new BooleanValidator().validateInternal(invalidBoolean), is(false));
     assertThat(new BooleanValidator().validate(invalidBoolean).size(), is(1));
-    assertThat(new BooleanValidator().validate(invalidBoolean), matcher);
+    assertThat(new BooleanValidator().validate(invalidBoolean), 
+        hasItem(hasAClass(equalTo(BooleanValidator.class))));
     
     invalidBoolean = "invalid";
     assertThat(new BooleanValidator().validateInternal(invalidBoolean), is(false));
     assertThat(new BooleanValidator().validate(invalidBoolean).size(), is(1));
-    assertThat(new BooleanValidator().validate(invalidBoolean), matcher);
+    assertThat(new BooleanValidator().validate(invalidBoolean), 
+        hasItem(hasAClass(equalTo(BooleanValidator.class))));
   }
   
   @Test
@@ -474,9 +479,8 @@ public class TestValidators {
     String invalidClazzName = "invalid-.class.name";
     assertThat(new ClassValidator().validateInternal(invalidClazzName), is(false));
     assertThat(new ClassValidator().validate(invalidClazzName).size(), is(1));
-
-    Matcher<Iterable<? super ConstraintViolation>> matcher = hasItem(hasAClass(equalTo(ClassValidator.class)));
-    assertThat(new ClassValidator().validate(invalidClazzName), matcher);
+    assertThat(new ClassValidator().validate(invalidClazzName), 
+        hasItem(hasAClass(equalTo(ClassValidator.class))));
   }
   
   @Test
@@ -492,9 +496,8 @@ public class TestValidators {
     String invalidAsciiString = "   inva - ";
     assertThat(new JavaStringValidator().validateInternal(invalidAsciiString), is(false));
     assertThat(new JavaStringValidator().validate(invalidAsciiString).size(), is(1));
-
-    Matcher<Iterable<? super ConstraintViolation>> matcher = hasItem(hasAClass(equalTo(JavaStringValidator.class)));
-    assertThat(new JavaStringValidator().validate(invalidAsciiString), matcher);
+    assertThat(new JavaStringValidator().validate(invalidAsciiString),
+        hasItem(hasAClass(equalTo(JavaStringValidator.class))));
   }
 
 }


Mime
View raw message