You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2012/05/16 20:50:31 UTC

[16/44] git commit: Convert TestNG to Spock

Convert TestNG to Spock


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/1df00a37
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/1df00a37
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/1df00a37

Branch: refs/heads/master
Commit: 1df00a371365a86d65ae61ec0e0e7fedd0e4dcf8
Parents: cf89064
Author: Howard M. Lewis Ship <hl...@gmail.com>
Authored: Fri May 4 14:19:20 2012 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Wed May 16 11:50:13 2012 -0700

----------------------------------------------------------------------
 .../services/ExceptionTrackerImplSpec.groovy       |   32 +++++++++++++
 .../services/ExceptionTrackerImplTest.java         |   37 ---------------
 2 files changed, 32 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1df00a37/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/internal/services/ExceptionTrackerImplSpec.groovy
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/internal/services/ExceptionTrackerImplSpec.groovy b/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/internal/services/ExceptionTrackerImplSpec.groovy
new file mode 100644
index 0000000..b86bd21
--- /dev/null
+++ b/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/internal/services/ExceptionTrackerImplSpec.groovy
@@ -0,0 +1,32 @@
+package org.apache.tapestry5.ioc.internal.services
+
+import spock.lang.Specification
+
+
+class ExceptionTrackerImplSpec extends Specification {
+
+  def "exceptions are tracked"() {
+
+    def t1 = new RuntimeException()
+    def t2 = new RuntimeException()
+
+    when: "with a new tracker"
+
+    def et = new ExceptionTrackerImpl()
+
+    then: "never logged exceptions return false"
+
+    !et.exceptionLogged(t1)
+    !et.exceptionLogged(t2)
+
+    then: "subsequently, the same exceptions return true"
+
+    et.exceptionLogged(t1)
+    et.exceptionLogged(t2)
+
+    then: "and again"
+
+    et.exceptionLogged(t1)
+    et.exceptionLogged(t2)
+  }
+}

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1df00a37/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/services/ExceptionTrackerImplTest.java
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/services/ExceptionTrackerImplTest.java b/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/services/ExceptionTrackerImplTest.java
deleted file mode 100644
index 91e8df3..0000000
--- a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/services/ExceptionTrackerImplTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2006 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
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package org.apache.tapestry5.ioc.internal.services;
-
-import org.apache.tapestry5.ioc.services.ExceptionTracker;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class ExceptionTrackerImplTest extends Assert
-{
-    @Test
-    public void check_exception_tracking()
-    {
-        Throwable t1 = new RuntimeException();
-        Throwable t2 = new RuntimeException();
-
-        ExceptionTracker et = new ExceptionTrackerImpl();
-
-        for (int i = 0; i < 3; i++)
-        {
-            assertEquals(et.exceptionLogged(t1), i != 0);
-            assertEquals(et.exceptionLogged(t2), i != 0);
-        }
-    }
-}