Compare commits

...
13 Commits
Author SHA1 Message Date
Peter Niederwieser 8a36b51de2 Update for Spock 1.0 2015-03-02 13:04:35 +01:00
Peter Niederwieser 5106695332 Switch Maven build to gmavenplus plugin and bump dependency versions 2015-02-25 18:12:23 +01:00
Peter Niederwieser 46aaca1936 Merge pull request #4 from roytruelove/patch-1
Simple typo fix
2014-12-12 01:48:22 +01:00
Peter Niederwieser 4adcffceaf Update dependencies 2014-12-08 00:47:42 +01:00
Peter Niederwieser 98ee8695b0 Update dependencies of Ant build 2014-09-09 20:05:24 -05:00
Peter Niederwieser 8db2e08b7c Updated dependency versions in Gradle/Maven/Ivy builds 2014-09-09 17:28:39 -05:00
Peter Niederwieser eea07a6542 Updated dependency and Gradle versions 2014-09-09 17:17:43 -05:00
Roy Truelove e5d3ae46ab Simple typo fix 2014-03-02 21:31:46 -05:00
Peter Niederwieser 0d107189af updated gradle & groovy versions 2013-07-06 00:21:30 +02:00
Peter Niederwieser 1c26a489f1 updated groovy, gradle, spock versions 2012-11-21 14:06:47 +01:00
Peter Niederwieser e4083e5bbe updated Gradle wrapper and Groovy version 2012-09-24 19:55:27 +02:00
Peter Niederwieser f91b9410f8 updated Gradle wrapper files 2012-08-04 14:40:33 -04:00
Peter Niederwieser 357b2dde35 updated gradle to 1.0
updated all builds to latest library versions
renamed specs to end in 'Spec' (easiest solution until we have a plugin for Maven 3.0)
2012-07-14 07:33:41 +02:00
18 changed files with 212 additions and 252 deletions
+10 -12
View File
@@ -1,6 +1,6 @@
apply plugin: "groovy" apply plugin: "groovy"
version = "0.6" version = "1.0"
description = "Spock Framework - Example Project" description = "Spock Framework - Example Project"
// Spock works with Java 1.5 and above // Spock works with Java 1.5 and above
@@ -9,22 +9,22 @@ sourceCompatibility = 1.5
repositories { repositories {
// Spock releases are available from Maven Central // Spock releases are available from Maven Central
mavenCentral() mavenCentral()
// Spock development snapshots are available from Spock's Maven repo // Spock snapshots are available from the Sonatype OSS snapshot repository
maven { url "http://m2repo.spockframework.org/snapshots" } maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
} }
dependencies { dependencies {
// mandatory dependencies for using Spock // mandatory dependencies for using Spock
groovy "org.codehaus.groovy:groovy-all:1.8.6" compile "org.codehaus.groovy:groovy-all:2.4.1"
testCompile "org.spockframework:spock-core:0.6-groovy-1.8" testCompile "org.spockframework:spock-core:1.0-groovy-2.4"
// optional dependencies for using Spock // optional dependencies for using Spock
testCompile "org.hamcrest:hamcrest-core:1.2" // only necessary if Hamcrest matchers are used testCompile "org.hamcrest:hamcrest-core:1.3" // only necessary if Hamcrest matchers are used
testRuntime "cglib:cglib-nodep:2.2" // allows mocking of classes (in addition to interfaces) testRuntime "cglib:cglib-nodep:3.1" // allows mocking of classes (in addition to interfaces)
testRuntime "org.objenesis:objenesis:1.2" // allows mocking of classes without default constructor (together with CGLIB) testRuntime "org.objenesis:objenesis:2.1" // allows mocking of classes without default constructor (together with CGLIB)
// dependencies used by examples in this project // dependencies used by examples in this project
testRuntime "com.h2database:h2:1.3.164" testRuntime "com.h2database:h2:1.4.182"
} }
// the remaining configuration is specific to this project, and is not required for using Spock // the remaining configuration is specific to this project, and is not required for using Spock
@@ -36,7 +36,5 @@ task collectJars(type: Copy) {
from configurations.testRuntime from configurations.testRuntime
} }
task wrapper(type: Wrapper) {
gradleVersion = "1.0-milestone-9"
}
+11 -15
View File
@@ -3,7 +3,8 @@
<property name="resource.dir" location="src/test/resources" /> <property name="resource.dir" location="src/test/resources" />
<property name="build.dir" location="ant/build" /> <property name="build.dir" location="ant/build" />
<property name="lib.dir" location="ant/lib" /> <property name="lib.dir" location="ant/lib" />
<property name="maven.ant.tasks.url" value="http://www.apache.org/dist/maven/binaries/maven-ant-tasks-2.1.3.jar" />
<property name="maven.ant.tasks.url" value="http://mirror.sdunix.com/apache/maven/ant-tasks/2.1.3/binaries/maven-ant-tasks-2.1.3.jar" />
<property name="maven.ant.tasks.jar" value="${lib.dir}${file.separator}maven-ant-tasks-2.1.3.jar" /> <property name="maven.ant.tasks.jar" value="${lib.dir}${file.separator}maven-ant-tasks-2.1.3.jar" />
<available property="maven.ant.tasks.jar.exists" file="${maven.ant.tasks.jar}" /> <available property="maven.ant.tasks.jar.exists" file="${maven.ant.tasks.jar}" />
@@ -27,45 +28,40 @@
<dependency <dependency
groupId="org.spockframework" groupId="org.spockframework"
artifactId="spock-core" artifactId="spock-core"
version="0.6-groovy-1.8" /> version="1.0-groovy-2.4" />
<!-- Optional dependencies for using Spock --> <!-- Optional dependencies for using Spock -->
<!-- enables mocking of classes (in addition to interfaces) --> <!-- enables mocking of classes (in addition to interfaces) -->
<dependency <dependency
groupId="cglib" groupId="cglib"
artifactId="cglib-nodep" artifactId="cglib-nodep"
version="2.2" /> version="3.1" />
<!-- enables mocking of classes without parameterless constructor (together with CGLIB) --> <!-- enables mocking of classes without parameterless constructor (together with CGLIB) -->
<dependency <dependency
groupId="org.objenesis" groupId="org.objenesis"
artifactId="objenesis" artifactId="objenesis"
version="1.2" /> version="2.1" />
<!-- only required if Spock's Ant selector is used, which finds spec classes regardless of their name --> <!-- only required if Spock's Ant selector is used, which finds spec classes regardless of their name -->
<dependency <dependency
groupId="asm" groupId="org.ow2.asm"
artifactId="asm" artifactId="asm"
version="3.2" /> version="5.0.3" />
<!-- only required if Hamcrest matchers are used --> <!-- only required if Hamcrest matchers are used -->
<dependency <dependency
groupId="org.hamcrest" groupId="org.hamcrest"
artifactId="hamcrest-core" artifactId="hamcrest-core"
version="1.2" /> version="1.3" />
<!-- only necessary if Hamcrest matchers are used -->
<dependency
groupId="org.hamcrest"
artifactId="hamcrest-core"
version="1.2" />
<!-- Dependencies used by examples in this project (not required for using Spock) --> <!-- Dependencies used by examples in this project (not required for using Spock) -->
<dependency <dependency
groupId="com.h2database" groupId="com.h2database"
artifactId="h2" artifactId="h2"
version="1.3.164" /> version="1.4.182" />
<remoteRepository <remoteRepository
id="maven-central" id="maven-central"
url="http://repo1.maven.org/maven2/" /> url="https://repo1.maven.org/maven2/" />
<!-- Only required if a snapshot version of Spock is used --> <!-- Only required if a snapshot version of Spock is used -->
<remoteRepository <remoteRepository
id="spock-snapshots" id="spock-snapshots"
url="http://m2repo.spockframework.org/snapshots/" /> url="https://oss.sonatype.org/content/repositories/snapshots/" />
</artifact:dependencies> </artifact:dependencies>
</target> </target>
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
#Sat Apr 30 21:41:20 CEST 2011 #Mon Mar 02 13:00:44 CET 2015
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.0-milestone-9-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-bin.zip
Vendored
+55 -59
View File
@@ -1,16 +1,16 @@
#!/bin/bash #!/usr/bin/env bash
############################################################################## ##############################################################################
## ## ##
## Gradle wrapper script for UN*X ## ## Gradle start up script for UN*X
## ## ##
############################################################################## ##############################################################################
# Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
# GRADLE_OPTS="$GRADLE_OPTS -Xmx512m" DEFAULT_JVM_OPTS=""
# JAVA_OPTS="$JAVA_OPTS -Xmx512m"
GRADLE_APP_NAME=Gradle APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD="maximum"
@@ -42,54 +42,51 @@ case "`uname`" in
;; ;;
esac esac
# Attempt to set JAVA_HOME if it's not already set.
if [ -z "$JAVA_HOME" ] ; then
if $darwin ; then
[ -z "$JAVA_HOME" -a -d "/Library/Java/Home" ] && export JAVA_HOME="/Library/Java/Home"
[ -z "$JAVA_HOME" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] && export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
else
javaExecutable="`which javac`"
[ -z "$javaExecutable" -o "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ] && die "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME."
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
[ `expr "$readLink" : '\([^ ]*\)'` = "no" ] && die "JAVA_HOME not set and readlink not available, please set JAVA_HOME."
javaExecutable="`readlink -f \"$javaExecutable\"`"
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
export JAVA_HOME="$javaHome"
fi
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched. # For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then if $cygwin ; then
[ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"`
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi fi
STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain # Attempt to set APP_HOME
CLASSPATH=`dirname "$0"`/gradle/wrapper/gradle-wrapper.jar # Resolve links: $0 may be a link
WRAPPER_PROPERTIES=`dirname "$0"`/gradle/wrapper/gradle-wrapper.properties PRG="$0"
# Determine the Java command to use to start the JVM. # Need this for relative symlinks.
if [ -z "$JAVACMD" ] ; then while [ -h "$PRG" ] ; do
if [ -n "$JAVA_HOME" ] ; then ls=`ls -ld "$PRG"`
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then link=`expr "$ls" : '.*-> \(.*\)$'`
# IBM's JDK on AIX uses strange locations for the executables if expr "$link" : '/.*' > /dev/null; then
JAVACMD="$JAVA_HOME/jre/sh/java" PRG="$link"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else else
JAVACMD="java" PRG=`dirname "$PRG"`"/$link"
fi fi
fi done
if [ ! -x "$JAVACMD" ] ; then SAVED="`pwd`"
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
if [ -z "$JAVA_HOME" ] ; then
warn "JAVA_HOME environment variable is not set"
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
@@ -104,19 +101,18 @@ if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD" warn "Could not set maximum file descriptor limit: $MAX_FD"
fi fi
else else
warn "Could not query businessSystem maximum file descriptor limit: $MAX_FD_LIMIT" warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi fi
fi fi
# For Darwin, add GRADLE_APP_NAME to the JAVA_OPTS as -Xdock:name # For Darwin, add options to specify how the application appears in the dock
if $darwin; then if $darwin; then
JAVA_OPTS="$JAVA_OPTS -Xdock:name=$GRADLE_APP_NAME" GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
# we may also want to set -Xdock:image
fi fi
# For Cygwin, switch paths to Windows format before running java # For Cygwin, switch paths to Windows format before running java
if $cygwin ; then if $cygwin ; then
JAVA_HOME=`cygpath --path --mixed "$JAVA_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath
@@ -143,7 +139,7 @@ if $cygwin ; then
eval `echo args$i`="\"$arg\"" eval `echo args$i`="\"$arg\""
fi fi
i=$((i+1)) i=$((i+1))
done done
case $i in case $i in
(0) set -- ;; (0) set -- ;;
(1) set -- "$args0" ;; (1) set -- "$args0" ;;
@@ -158,11 +154,11 @@ if $cygwin ; then
esac esac
fi fi
GRADLE_APP_BASE_NAME=`basename "$0"` # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" $JAVA_OPTS $GRADLE_OPTS \ exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
-classpath "$CLASSPATH" \
-Dorg.gradle.appname="$GRADLE_APP_BASE_NAME" \
-Dorg.gradle.wrapper.properties="$WRAPPER_PROPERTIES" \
$STARTER_MAIN_CLASS \
"$@"
Vendored
+90 -82
View File
@@ -1,82 +1,90 @@
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem ## @rem
@rem Gradle startup script for Windows ## @rem Gradle startup script for Windows
@rem ## @rem
@rem ########################################################################## @rem ##########################################################################
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
@rem Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
@rem set GRADLE_OPTS=%GRADLE_OPTS% -Xmx512m set DEFAULT_JVM_OPTS=
@rem set JAVA_OPTS=%JAVA_OPTS% -Xmx512m
set DIRNAME=%~dp0
set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%" == "" set DIRNAME=.\ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
set JAVA_EXE=java.exe @rem Find java.exe
if not defined JAVA_HOME goto init if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=java.exe
set JAVA_EXE=%JAVA_HOME%/bin/java.exe %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if exist "%JAVA_EXE%" goto init
echo.
echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo.
echo. echo Please set the JAVA_HOME variable in your environment to match the
echo Please set the JAVA_HOME variable in your environment to match the echo location of your Java installation.
echo location of your Java installation.
echo. goto fail
goto end
:findJavaFromJavaHome
:init set JAVA_HOME=%JAVA_HOME:"=%
@rem Get command-line arguments, handling Windowz variants set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if not "%OS%" == "Windows_NT" goto win9xME_args if exist "%JAVA_EXE%" goto init
if "%eval[2+2]" == "4" goto 4NT_args
echo.
:win9xME_args echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@rem Slurp the command line arguments. echo.
set CMD_LINE_ARGS= echo Please set the JAVA_HOME variable in your environment to match the
set _SKIP=2 echo location of your Java installation.
:win9xME_args_slurp goto fail
if "x%~1" == "x" goto execute
:init
set CMD_LINE_ARGS=%* @rem Get command-line arguments, handling Windowz variants
goto execute
if not "%OS%" == "Windows_NT" goto win9xME_args
:4NT_args if "%@eval[2+2]" == "4" goto 4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$ :win9xME_args
@rem Slurp the command line arguments.
:execute set CMD_LINE_ARGS=
@rem Setup the command line set _SKIP=2
set STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain :win9xME_args_slurp
set CLASSPATH=%DIRNAME%\gradle\wrapper\gradle-wrapper.jar if "x%~1" == "x" goto execute
set WRAPPER_PROPERTIES=%DIRNAME%\gradle\wrapper\gradle-wrapper.properties
set CMD_LINE_ARGS=%*
set GRADLE_OPTS=%JAVA_OPTS% %GRADLE_OPTS% -Dorg.gradle.wrapper.properties="%WRAPPER_PROPERTIES%" goto execute
@rem Execute Gradle :4NT_args
"%JAVA_EXE%" %GRADLE_OPTS% -classpath "%CLASSPATH%" %STARTER_MAIN_CLASS% %CMD_LINE_ARGS% @rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:end
@rem End local scope for the variables with windows NT shell :execute
if "%ERRORLEVEL%"=="0" goto mainEnd @rem Setup the command line
if not "%OS%"=="Windows_NT" echo 1 > nul | choice /n /c:1 set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of @rem Execute Gradle
rem the _cmd.exe /c_ return code! "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
if not "" == "%GRADLE_EXIT_CONSOLE%" exit "%ERRORLEVEL%"
exit /b "%ERRORLEVEL%" :end
@rem End local scope for the variables with windows NT shell
:mainEnd if "%ERRORLEVEL%"=="0" goto mainEnd
if "%OS%"=="Windows_NT" endlocal
:fail
:omega rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+27 -65
View File
@@ -4,25 +4,24 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.spockframework</groupId> <groupId>org.spockframework</groupId>
<artifactId>spock-example</artifactId> <artifactId>spock-example</artifactId>
<version>0.6</version> <version>1.0-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Spock Framework - Example Project</name> <name>Spock Framework - Example Project</name>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties> </properties>
<build> <build>
<!-- Mandatory plugins for using Spock -->
<plugins> <plugins>
<!-- Mandatory plugins for using Spock -->
<plugin> <plugin>
<groupId>org.codehaus.gmaven</groupId> <!-- The gmavenplus plugin is used to compile Groovy code. To learn more about this plugin,
<artifactId>gmaven-plugin</artifactId> visit https://github.com/groovy/GMavenPlus/wiki -->
<version>1.3</version> <groupId>org.codehaus.gmavenplus</groupId>
<configuration> <artifactId>gmavenplus-plugin</artifactId>
<providerSelection>1.7</providerSelection> <version>1.4</version>
</configuration>
<executions> <executions>
<execution> <execution>
<goals> <goals>
@@ -31,48 +30,17 @@
</goals> </goals>
</execution> </execution>
</executions> </executions>
<dependencies>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-1.7</artifactId>
<version>1.3</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.6</version>
</dependency>
</dependencies>
</plugin> </plugin>
<!-- Optional plugins for using Spock --> <!-- Optional plugins for using Spock -->
<plugin> <!-- Only required if names of spec classes don't match default Surefire patterns (`*Test` etc.) -->
<!--
Finds all Spock specifications in this project, and configures Maven to run them
If this plugin is removed, Spock specifications will need to adhere to Maven's naming conventions for test classes
-->
<groupId>org.spockframework</groupId>
<artifactId>spock-maven</artifactId>
<version>0.6-groovy-1.8</version>
<executions>
<execution>
<goals>
<goal>find-specs</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Only required if default Surefire configuration is not satisfactory -->
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version> <version>2.6</version>
<configuration> <configuration>
<useFile>false</useFile> <useFile>false</useFile>
<includes>
<include>**/*Spec.java</include>
</includes>
</configuration> </configuration>
</plugin> </plugin>
<!-- Only required for spock-example build --> <!-- Only required for spock-example build -->
@@ -91,59 +59,53 @@
<dependency> <dependency>
<groupId>org.spockframework</groupId> <groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId> <artifactId>spock-core</artifactId>
<version>0.6-groovy-1.8</version> <version>1.0-groovy-2.4</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- Optional dependencies for using Spock --> <!-- Optional dependencies for using Spock -->
<dependency> <!-- use a specific Groovy version rather than the one specified by spock-core -->
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.1</version>
</dependency>
<dependency> <!-- enables mocking of classes (in addition to interfaces) --> <dependency> <!-- enables mocking of classes (in addition to interfaces) -->
<groupId>cglib</groupId> <groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId> <artifactId>cglib-nodep</artifactId>
<version>2.2</version> <version>3.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <!-- enables mocking of classes without default constructor (together with CGLIB) --> <dependency> <!-- enables mocking of classes without default constructor (together with CGLIB) -->
<groupId>org.objenesis</groupId> <groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId> <artifactId>objenesis</artifactId>
<version>1.2</version> <version>2.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <!-- only necessary if Hamcrest matchers are used --> <dependency> <!-- only required if Hamcrest matchers are used -->
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId> <artifactId>hamcrest-core</artifactId>
<version>1.2</version> <version>1.3</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- Dependencies used by examples in this project (not required for using Spock) --> <!-- Dependencies used by examples in this project (not required for using Spock) -->
<dependency> <dependency>
<groupId>com.h2database</groupId> <groupId>com.h2database</groupId>
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
<version>1.3.164</version> <version>1.4.185</version>
</dependency> </dependency>
</dependencies> </dependencies>
<repositories> <repositories>
<!-- Only required if a snapshot version of Spock is used --> <!-- Only required if a snapshot version of Spock is used -->
<repository> <repository>
<id>spock-snapshots</id> <id>spock-snapshots</id>
<url>http://m2repo.spockframework.org/snapshots</url> <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots> <snapshots>
<enabled>true</enabled> <enabled>true</enabled>
</snapshots> </snapshots>
</repository> </repository>
</repositories> </repositories>
<!-- Only required if a snapshot version of Spock's Maven plugin is used --> <!-- Only required in spock-example build -->
<pluginRepositories>
<pluginRepository>
<id>spock-snapshots</id>
<url>http://m2repo.spockframework.org/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<!-- Only required for spock-example build -->
<distributionManagement> <distributionManagement>
<repository> <repository>
<id>foo</id> <id>foo</id>
@@ -17,7 +17,7 @@
import spock.lang.* import spock.lang.*
@Unroll @Unroll
class DataDriven extends Specification { class DataDrivenSpec extends Specification {
def "maximum of two numbers"() { def "maximum of two numbers"() {
expect: expect:
Math.max(a, b) == c Math.max(a, b) == c
@@ -48,11 +48,11 @@ class DataDriven extends Specification {
new Person(name: "Fred") || "Male" new Person(name: "Fred") || "Male"
new Person(name: "Wilma") || "Female" new Person(name: "Wilma") || "Female"
} }
}
private class Person { static class Person {
String name String name
String getSex() { String getSex() {
name == "Fred" ? "Male" : "Female" name == "Fred" ? "Male" : "Female"
}
} }
} }
@@ -18,7 +18,7 @@ import groovy.sql.Sql
import spock.lang.Shared import spock.lang.Shared
import spock.lang.Specification import spock.lang.Specification
class DatabaseDriven extends Specification { class DatabaseDrivenSpec extends Specification {
@Shared sql = Sql.newInstance("jdbc:h2:mem:", "org.h2.Driver") @Shared sql = Sql.newInstance("jdbc:h2:mem:", "org.h2.Driver")
// insert data (usually the database would already contain the data) // insert data (usually the database would already contain the data)
@@ -25,7 +25,7 @@ import static spock.util.matcher.HamcrestMatchers.closeTo
* @author Peter Niederwiser * @author Peter Niederwiser
* @since 0.5 * @since 0.5
*/ */
class HamcrestMatchers extends Specification { class HamcrestMatchersSpec extends Specification {
def "comparing two decimal numbers"() { def "comparing two decimal numbers"() {
def myPi = 3.14 def myPi = 3.14
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
class HelloSpock extends spock.lang.Specification { class HelloSpockSpec extends spock.lang.Specification {
def "length of Spock's and his friends' names"() { def "length of Spock's and his friends' names"() {
expect: expect:
name.size() == length name.size() == length
@@ -37,7 +37,7 @@ import spock.lang.Specification
* *
* @since 0.4 * @since 0.4
*/ */
class IncludeExcludeExtension extends Specification { class IncludeExcludeExtensionSpec extends Specification {
static { static {
System.setProperty "spock.configuration", "IncludeFastConfig.groovy" System.setProperty "spock.configuration", "IncludeFastConfig.groovy"
@@ -22,7 +22,7 @@ import spock.lang.*
* *
* @since 0.4 * @since 0.4
*/ */
class OrderedInteractions extends Specification { class OrderedInteractionsSpec extends Specification {
def "collaborators must be invoked in order"() { def "collaborators must be invoked in order"() {
def coll1 = Mock(Collaborator) def coll1 = Mock(Collaborator)
def coll2 = Mock(Collaborator) def coll2 = Mock(Collaborator)
@@ -16,7 +16,7 @@
import spock.lang.Specification import spock.lang.Specification
class EmptyStack extends Specification { class EmptyStackSpec extends Specification {
def stack = new Stack() def stack = new Stack()
def "size"() { def "size"() {
@@ -43,7 +43,7 @@ class EmptyStack extends Specification {
} }
} }
class StackWithOneElement extends Specification { class StackWithOneElementSpec extends Specification {
def stack = new Stack() def stack = new Stack()
def setup() { def setup() {
@@ -82,7 +82,7 @@ class StackWithOneElement extends Specification {
} }
} }
class StackWithThreeElements extends Specification { class StackWithThreeElementsSpec extends Specification {
def stack = new Stack() def stack = new Stack()
def setup() { def setup() {
@@ -16,7 +16,7 @@ import spock.lang.*
/** /**
* Demonstrates how &#64;Stepwise causes a spec to be run in incremental steps. * Demonstrates how &#64;Stepwise causes a spec to be run in incremental steps.
* Change a step's condition from <tt>true</tt> to <tt>false</tt>, and observer * Change a step's condition from <tt>true</tt> to <tt>false</tt>, and observe
* how the remaining steps will be skipped automatically on the next run. * how the remaining steps will be skipped automatically on the next run.
* Also notice that if you run a single step (e.g. from the IDE's context menu), * Also notice that if you run a single step (e.g. from the IDE's context menu),
* all prior steps will also be run. * all prior steps will also be run.
@@ -27,7 +27,7 @@ import spock.lang.*
* @since 0.4 * @since 0.4
*/ */
@Stepwise @Stepwise
class StepwiseExtension extends Specification { class StepwiseExtensionSpec extends Specification {
def "step 1"() { def "step 1"() {
expect: true // try to change this to 'false' expect: true // try to change this to 'false'
} }
@@ -16,7 +16,7 @@ import org.junit.Rule
import org.junit.rules.TestName import org.junit.rules.TestName
import spock.lang.Specification import spock.lang.Specification
class UsingJUnitRules extends Specification { class UsingJUnitRulesSpec extends Specification {
@Rule TestName name @Rule TestName name
def "retrieve test name at runtime"() { def "retrieve test name at runtime"() {