Skip to content

Commit

Permalink
GRAILS-3237 - Replace JUnit 3 with JUnit 4.
Browse files Browse the repository at this point in the history
Our custom runner mimics JUnit 3 behaviours like the “test”, “setUp” and “tearDown” conventions for backwards compatibility.
  • Loading branch information
ldaley committed Mar 9, 2010
1 parent 041c47b commit 8a6d774
Show file tree
Hide file tree
Showing 32 changed files with 658 additions and 479 deletions.
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bundlor.spring.version=3.0.0.RELEASE
bundlor.ant.version=1.7.1
bundlor.ivy.version=2.0.0
bundlor.gant.version=1.9.1
bundlor.junit.version=3.8.2
bundlor.junit.version=4.8.1
bundlor.commons.logging.version=1.1.0
bundlor.commons.beanutils.version=1.8.0
bundlor.commons.lang.version=2.4.0
Expand Down
4 changes: 2 additions & 2 deletions dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ The following libraries are included in Grails because they are required either
- Java Transaction API
- required for running Grails applications

* junit-3.8.2.jar
- JUnit 3.8.2 (http://junit.org) CPL 1.0 License
* junit-4.8.1.jar
- JUnit 4.8.1 (http://junit.org) CPL 1.0 License
- required for building Grails core
- required for the command line tools (Gant)

Expand Down
2 changes: 1 addition & 1 deletion grails.ipr
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@
</library>
<library name="JUnit">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/junit-3.8.2.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/junit-4.8.1.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/ant-junit-1.7.1.jar!/" />
</CLASSES>
<JAVADOC />
Expand Down
4 changes: 2 additions & 2 deletions ivy.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0">
<info organisation="codehaus" module="grails"/>
<dependencies>
Expand All @@ -16,7 +16,7 @@
<dependency org="apache" name="commons-pool" rev="1.2"/>
<dependency org="apache" name="commons-validator" rev="1.3.0"/>
<dependency org="dom4j" name="dom4j" rev="1.6.1"/>
<dependency org="junit" name="junit" rev="3.8.1"/>
<dependency org="junit" name="junit" rev="4.8.1"/>
<!--<dependency org="rhino" name="js" rev="1.6R2"/> -->
<dependency org="log4j" name="log4j" rev="1.2.8"/>
<!--<dependency org="ognl" name="ognl" rev="2.6.9"/>
Expand Down
Binary file removed lib/junit-3.8.2.jar
Binary file not shown.
Binary file added lib/junit-4.8.1.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion maven/grails-core.pom.in
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion maven/grails-crud.pom.in
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion maven/grails-gorm.pom.in
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion maven/grails-scripts.pom.in
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<version>4.8.1</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion maven/grails-spring.pom.in
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
3 changes: 2 additions & 1 deletion maven/grails-test.mf
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ Import-Template:
org.codehaus.groovy.ant.*;version="${groovy.version:[=.=.=, =.+1.0)}",
org.codehaus.groovy.tools.*;version="${groovy.version:[=.=.=, =.+1.0)}",
org.codehaus.groovy.grails.*;version="${grails.version:[=.=.=, +1.0.0)}",
org.springframework.*;version="${spring.version:[=.=.=, +1.0.0)}"
org.springframework.*;version="${spring.version:[=.=.=, +1.0.0)}",
org.junit.*;version="${junit.version:[=.=.=, +1.0.0)}"
2 changes: 1 addition & 1 deletion maven/grails-test.pom.in
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<version>4.8.1</version>
<scope>runtime</scope>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion maven/grails-web.pom.in
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion maven/grails-webflow.pom.in
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
10 changes: 5 additions & 5 deletions scripts/_GrailsTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import org.codehaus.groovy.grails.support.PersistenceContextInterceptor
import org.codehaus.groovy.grails.web.context.GrailsConfigUtils
import grails.util.GrailsUtil

import org.codehaus.groovy.grails.test.junit3.JUnit3GrailsTestType
import org.codehaus.groovy.grails.test.junit3.JUnit3GrailsTestTypeMode
import org.codehaus.groovy.grails.test.junit4.JUnit4GrailsTestType
import org.codehaus.groovy.grails.test.support.GrailsTestMode
import org.codehaus.groovy.grails.test.report.junit.JUnitReportsFactory
import org.codehaus.groovy.grails.test.report.junit.JUnitReportProcessor

Expand Down Expand Up @@ -128,14 +128,14 @@ target(allTests: "Runs the project's tests.") {
if (rawType instanceof CharSequence) {
def rawTypeString = rawType.toString()
if (phaseName in ['integration', 'functional']) {
def mode = new JUnit3GrailsTestTypeMode(
def mode = new GrailsTestMode(
autowire: true,
wrapInTransaction: phaseName == "integration",
wrapInRequestEnvironment: phaseName == "integration"
)
new JUnit3GrailsTestType(rawTypeString, rawTypeString, mode)
new JUnit4GrailsTestType(rawTypeString, rawTypeString, mode)
} else {
new JUnit3GrailsTestType(rawTypeString, rawTypeString)
new JUnit4GrailsTestType(rawTypeString, rawTypeString)
}
} else {
rawType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public class IvyDependencyManager extends AbstractIvyDependencyManager implement


// dependencies needed for running tests
test "junit:junit:3.8.2",
test "junit:junit:4.8.1",
"org.grails:grails-test:$grailsVersion",
"org.springframework:org.springframework.test:3.0.0.RELEASE"

Expand Down Expand Up @@ -359,7 +359,7 @@ public class IvyDependencyManager extends AbstractIvyDependencyManager implement
}

/**
* For usages such as addPluginDependency("foo", [group:"junit", name:"junit", version:"3.8.2"])
* For usages such as addPluginDependency("foo", [group:"junit", name:"junit", version:"4.8.1"])
*
* This method is designed to be used by the internal framework and plugins and not be end users.
* The idea is that plugins can provide dependencies at runtime which are then inherited by
Expand Down

This file was deleted.

Loading

0 comments on commit 8a6d774

Please sign in to comment.