Repository: tapestry-5 Updated Branches: refs/heads/master e76618a48 -> a5f67e9e4
Fix broken tests Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a5f67e9e Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a5f67e9e Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a5f67e9e Branch: refs/heads/master Commit: a5f67e9e41e3f96aca8257cb3f594af5b3909bd5 Parents: e76618a Author: Howard M. Lewis Ship <[email protected]> Authored: Thu Jul 17 13:08:11 2014 -0700 Committer: Howard M. Lewis Ship <[email protected]> Committed: Thu Jul 17 13:08:11 2014 -0700 ---------------------------------------------------------------------- .../org/apache/tapestry5/validator/MaxTest.java | 18 ++++------- .../org/apache/tapestry5/validator/MinTest.java | 14 +++------ .../tapestry5/validator/RequiredTest.java | 32 ++++++++++++-------- 3 files changed, 30 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a5f67e9e/tapestry-core/src/test/java/org/apache/tapestry5/validator/MaxTest.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/validator/MaxTest.java b/tapestry-core/src/test/java/org/apache/tapestry5/validator/MaxTest.java index ecf3f84..1135310 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/validator/MaxTest.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/validator/MaxTest.java @@ -1,5 +1,3 @@ -// Copyright 2007, 2012, 2014 The Apache Software Foundation -// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -16,16 +14,13 @@ package org.apache.tapestry5.validator; import org.apache.tapestry5.Field; import org.apache.tapestry5.ValidationException; -import org.apache.tapestry5.annotations.SetupRender; import org.apache.tapestry5.internal.test.InternalBaseTestCase; import org.apache.tapestry5.ioc.MessageFormatter; -import org.apache.tapestry5.services.Html5Support; -import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class MaxTest extends InternalBaseTestCase { - + @Test public void small_enough() throws Exception { @@ -33,10 +28,10 @@ public class MaxTest extends InternalBaseTestCase MessageFormatter formatter = mockMessageFormatter(); Long constraint = 50L; - replay(); - Max validator = new Max(null, mockHtml5Support()); + replay(); + for (int value = 48; value <= 50; value++) validator.validate(field, constraint, formatter, value); @@ -55,16 +50,15 @@ public class MaxTest extends InternalBaseTestCase train_format(formatter, message, constraint, label); - replay(); - Max validator = new Max(null, mockHtml5Support()); + replay(); + try { validator.validate(field, constraint, formatter, value); unreachable(); - } - catch (ValidationException ex) + } catch (ValidationException ex) { assertEquals(ex.getMessage(), message); } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a5f67e9e/tapestry-core/src/test/java/org/apache/tapestry5/validator/MinTest.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/validator/MinTest.java b/tapestry-core/src/test/java/org/apache/tapestry5/validator/MinTest.java index c76deb1..408a19a 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/validator/MinTest.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/validator/MinTest.java @@ -1,5 +1,3 @@ -// Copyright 2007, 2012, 2014 The Apache Software Foundation -// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -18,7 +16,6 @@ import org.apache.tapestry5.Field; import org.apache.tapestry5.ValidationException; import org.apache.tapestry5.internal.test.InternalBaseTestCase; import org.apache.tapestry5.ioc.MessageFormatter; -import org.apache.tapestry5.services.Html5Support; import org.testng.annotations.Test; public class MinTest extends InternalBaseTestCase @@ -30,10 +27,10 @@ public class MinTest extends InternalBaseTestCase MessageFormatter formatter = mockMessageFormatter(); Long constraint = 50L; - replay(); - Min validator = new Min(null, mockHtml5Support()); + replay(); + for (int value = 50; value < 52; value++) validator.validate(field, constraint, formatter, value); @@ -52,16 +49,15 @@ public class MinTest extends InternalBaseTestCase train_format(formatter, message, constraint, label); - replay(); - Min validator = new Min(null, mockHtml5Support()); + replay(); + try { validator.validate(field, constraint, formatter, value); unreachable(); - } - catch (ValidationException ex) + } catch (ValidationException ex) { assertEquals(ex.getMessage(), message); } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a5f67e9e/tapestry-core/src/test/java/org/apache/tapestry5/validator/RequiredTest.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/validator/RequiredTest.java b/tapestry-core/src/test/java/org/apache/tapestry5/validator/RequiredTest.java index 3f53d9e..ebc0648 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/validator/RequiredTest.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/validator/RequiredTest.java @@ -1,5 +1,3 @@ -// Copyright 2006, 2007, 2012, 2014 The Apache Software Foundation -// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -17,6 +15,7 @@ package org.apache.tapestry5.validator; import org.apache.tapestry5.Field; import org.apache.tapestry5.ValidationException; import org.apache.tapestry5.ioc.MessageFormatter; +import org.apache.tapestry5.services.Html5Support; import org.apache.tapestry5.test.TapestryTestCase; import org.testng.annotations.Test; @@ -32,14 +31,15 @@ public class RequiredTest extends TapestryTestCase train_format(formatter, "{message}", "My Field"); + Html5Support html5Support = mockHtml5Support(); + replay(); try { - new Required(null, mockHtml5Support()).validate(field, null, formatter, null); + new Required(null, html5Support).validate(field, null, formatter, null); unreachable(); - } - catch (ValidationException ex) + } catch (ValidationException ex) { assertEquals(ex.getMessage(), "{message}"); } @@ -55,14 +55,15 @@ public class RequiredTest extends TapestryTestCase train_format(formatter, "{message}", "My Field"); + Html5Support html5Support = mockHtml5Support(); + replay(); try { - new Required(null, mockHtml5Support()).validate(field, null, formatter, ""); + new Required(null, html5Support).validate(field, null, formatter, ""); unreachable(); - } - catch (ValidationException ex) + } catch (ValidationException ex) { assertEquals(ex.getMessage(), "{message}"); } @@ -78,14 +79,15 @@ public class RequiredTest extends TapestryTestCase train_format(formatter, "{message}", "My Field"); + Html5Support html5Support = mockHtml5Support(); + replay(); try { - new Required(null, mockHtml5Support()).validate(field, null, formatter, Arrays.asList()); + new Required(null, html5Support).validate(field, null, formatter, Arrays.asList()); unreachable(); - } - catch (ValidationException ex) + } catch (ValidationException ex) { assertEquals(ex.getMessage(), "{message}"); } @@ -99,9 +101,11 @@ public class RequiredTest extends TapestryTestCase MessageFormatter formatter = mockMessageFormatter(); Field field = mockField(); + Html5Support html5Support = mockHtml5Support(); + replay(); - new Required(null, mockHtml5Support()).validate(field, null, formatter, Arrays.asList("A", "B")); + new Required(null, html5Support).validate(field, null, formatter, Arrays.asList("A", "B")); verify(); } @@ -112,9 +116,11 @@ public class RequiredTest extends TapestryTestCase MessageFormatter formatter = mockMessageFormatter(); Field field = mockField(); + Html5Support html5Support = mockHtml5Support(); + replay(); - new Required(null, mockHtml5Support()).validate(field, null, formatter, "not null"); + new Required(null, html5Support).validate(field, null, formatter, "not null"); verify(); }
