-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Checking in the lib module.
- Loading branch information
Showing
8 changed files
with
120 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...t-runner-spock-test/src/test/groovy/org/infinitest/parser/JavaAssistClassSpockSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.infinitest.parser | ||
|
||
import javassist.ClassPool | ||
import javassist.NotFoundException | ||
import org.infinitest.testdata.HierarchicSpockSpec | ||
import org.infinitest.testdata.ParameterizedSpockSpec | ||
import org.infinitest.testdata.SimpleSpockSpec | ||
import spock.lang.Specification | ||
|
||
class JavaAssistClassSpockSpec extends Specification { | ||
|
||
private ClassPool classPool | ||
|
||
void setup() { | ||
classPool = new ClassPool() | ||
classPool.appendSystemPath() | ||
} | ||
|
||
void "should detect Spock 2 test (#clazz.simpleName)"() { | ||
expect: | ||
classFor(clazz).isATest() | ||
where: | ||
clazz << [SimpleSpockSpec, HierarchicSpockSpec, ParameterizedSpockSpec] | ||
} | ||
private JavaAssistClass classFor(Class<?> testClass) { | ||
try { | ||
return new JavaAssistClass(classPool.get(testClass.getName())); | ||
} catch (NotFoundException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...nitest-runner-spock-test/src/test/groovy/org/infinitest/testdata/AbstractSpockSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.infinitest.testdata | ||
|
||
import spock.lang.Specification | ||
|
||
abstract class AbstractSpockSpec extends Specification { | ||
|
||
void "should pass from abstract class"() { | ||
expect: | ||
1 | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...test-runner-spock-test/src/test/groovy/org/infinitest/testdata/HierarchicSpockSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.infinitest.testdata | ||
|
||
class HierarchicSpockSpec extends AbstractSpockSpec { | ||
|
||
void "should pass in hierarchy"() { | ||
expect: | ||
1 | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...t5/testdata/ParameterizedSpockSpec.groovy → ...st/testdata/ParameterizedSpockSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...er/junit5/testdata/SimpleSpockSpec.groovy → ...nfinitest/testdata/SimpleSpockSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package org.infinitest.testrunner.junit5.testdata | ||
package org.infinitest.testdata | ||
|
||
import spock.lang.Specification | ||
|
||
class SimpleSpockSpec extends Specification { | ||
|
||
void "should be executed and pass"() { | ||
expect: | ||
GroovySystem.getShortVersion() == "4.0" | ||
1 | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters