spock-seasar is integration with Spock Framework and S2JUnit4
Rewrite to Spock from a sample of S2JUnit4
package examples.s2junit4
import static org.seasar.framework.unit.S2Assert.assertEquals
import org.shiena.seasar.Seasar2Support
import org.junit.Ignore
import org.seasar.framework.unit.TestContext
import spock.lang.Specification
@Seasar2Support
class EmployeeDaoImplSpec extends Specification {
TestContext ctx
EmployeeDao dao
def getEmployee() {
when:
def emp = dao.getEmployee(9900)
then:
assertEquals "1", ctx.expected, emp
}
@Ignore("not implemented.")
def getEmployeeByName() {
}
}
To use with gradle, you may add the following snippet to your build.gradle
repositories {
maven {
url 'https://bitbucket.org/shiena/mvn-repo/raw/tip/'
}
}
dependencies {
testCompile 'org.shiena:spock-seasar:0.0.1'
}
To use with maven, you may add the following snippet to your pom.xml
<repositories>
<repository>
<url>https://bitbucket.org/shiena/mvn-repo/raw/tip/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.shiena</groupId>
<artifactId>spock-seasar</artifactId>
<version>0.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
This is a TestContext
that inherits InternalTestContextImpl
.
getFeatureName()
- Return the String name of the test methodgetIterationName()
- Return the String name of the unrolled test method
This is a TestContext
that inherits SimpleInternalTestContext
.
getFeatureName()
- Return the String name of the test methodgetIterationName()
- Return the String name of the unrolled test method
- Naming conventions for method
@Prerequisite
annotation@Mock
annotation@Mocks
annotation@EasyMock
annotation@PostBindFields
annotation@PreUnbindFields
annotation- Customizing the behavior using
s2junit4config.dicon
Can not be used together Spock and S2JUnit4 because it requires JUnit of different versions.
- Spock requires JUnit 4.7 or higher.
- S2JUnit4 requires JUnit 4.4.