You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2012/06/21 21:35:35 UTC
[4/6] 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/f4ac4aab
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/f4ac4aab
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/f4ac4aab
Branch: refs/heads/master
Commit: f4ac4aabafe22d67ed456700ff370392e43606db
Parents: 7d90bde
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Thu Jun 21 11:16:06 2012 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Thu Jun 21 11:16:06 2012 -0700
----------------------------------------------------------------------
.../ioc/specs/SingletonServiceLifecycleSpec.groovy | 27 +++++++++
.../internal/SingletonServiceLifecycleTest.java | 43 ---------------
.../tapestry5/ioc/internal/ToStringService.java | 17 ------
3 files changed, 27 insertions(+), 60 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f4ac4aab/tapestry-ioc/src/test/groovy/ioc/specs/SingletonServiceLifecycleSpec.groovy
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/test/groovy/ioc/specs/SingletonServiceLifecycleSpec.groovy b/tapestry-ioc/src/test/groovy/ioc/specs/SingletonServiceLifecycleSpec.groovy
new file mode 100644
index 0000000..d6afd3b
--- /dev/null
+++ b/tapestry-ioc/src/test/groovy/ioc/specs/SingletonServiceLifecycleSpec.groovy
@@ -0,0 +1,27 @@
+package ioc.specs
+
+import org.apache.tapestry5.ioc.ObjectCreator
+import org.apache.tapestry5.ioc.ServiceResources
+import org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle
+import spock.lang.Specification
+
+class SingletonServiceLifecycleSpec extends Specification {
+
+ def "creator is invoked"() {
+ ServiceResources resources = Mock()
+ ObjectCreator creator = Mock()
+ def expected = new Object()
+
+ def lifecycle = new SingletonServiceLifecycle()
+
+ when:
+
+ def actual = lifecycle.createService(resources, creator)
+
+ then:
+
+ 1 * creator.createObject() >> expected
+
+ actual.is expected
+ }
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f4ac4aab/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/SingletonServiceLifecycleTest.java
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/SingletonServiceLifecycleTest.java b/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/SingletonServiceLifecycleTest.java
deleted file mode 100644
index 4cd84ca..0000000
--- a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/SingletonServiceLifecycleTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2006, 2007 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;
-
-import org.apache.tapestry5.ioc.ObjectCreator;
-import org.apache.tapestry5.ioc.ServiceLifecycle;
-import org.apache.tapestry5.ioc.ServiceResources;
-import org.testng.annotations.Test;
-
-public class SingletonServiceLifecycleTest extends IOCInternalTestCase
-{
- @Test
- public void test()
- {
- ServiceResources resources = mockServiceResources();
- ObjectCreator creator = mockObjectCreator();
- Object expected = new Object();
-
- train_createObject(creator, expected);
-
- replay();
-
- ServiceLifecycle lifecycle = new SingletonServiceLifecycle();
-
- Object actual = lifecycle.createService(resources, creator);
-
- assertSame(actual, expected);
-
- verify();
- }
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f4ac4aab/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ToStringService.java
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ToStringService.java b/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ToStringService.java
index e039cfc..da1b5e7 100644
--- a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ToStringService.java
+++ b/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ToStringService.java
@@ -1,22 +1,5 @@
-// Copyright 2006, 2008 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;
-/**
- * Used by {@link org.apache.tapestry5.ioc.internal.SingletonServiceLifecycleTest}.
- */
public interface ToStringService
{
String toString();