-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Spock specs atomic if certain criteria are met
- Loading branch information
Showing
13 changed files
with
773 additions
and
30 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
382 changes: 361 additions & 21 deletions
382
src/main/java/org/pitest/junit5/JUnit5TestUnitFinder.java
Large diffs are not rendered by default.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
src/test/groovy/org/pitest/junit5/repository/TestSpecWithAfterAll.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 @@ | ||
/* | ||
* Copyright 2023 Björn Kautler | ||
* | ||
* 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.pitest.junit5.repository | ||
|
||
import org.junit.jupiter.api.AfterAll | ||
import spock.lang.Specification | ||
|
||
class TestSpecWithAfterAll extends Specification { | ||
@AfterAll | ||
static afterAll() { | ||
} | ||
|
||
def test() { | ||
expect: | ||
true | ||
|
||
where: | ||
i << (1..2) | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/test/groovy/org/pitest/junit5/repository/TestSpecWithAfterClass.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 @@ | ||
/* | ||
* Copyright 2023 Björn Kautler | ||
* | ||
* 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.pitest.junit5.repository | ||
|
||
import org.junit.AfterClass | ||
import spock.lang.Specification | ||
|
||
class TestSpecWithAfterClass extends Specification { | ||
@AfterClass | ||
static afterClass() { | ||
} | ||
|
||
def test() { | ||
expect: | ||
true | ||
|
||
where: | ||
i << (1..2) | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/test/groovy/org/pitest/junit5/repository/TestSpecWithBeforeAll.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 @@ | ||
/* | ||
* Copyright 2023 Björn Kautler | ||
* | ||
* 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.pitest.junit5.repository | ||
|
||
import org.junit.jupiter.api.BeforeAll | ||
import spock.lang.Specification | ||
|
||
class TestSpecWithBeforeAll extends Specification { | ||
@BeforeAll | ||
static beforeAll() { | ||
} | ||
|
||
def test() { | ||
expect: | ||
true | ||
|
||
where: | ||
i << (1..2) | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/test/groovy/org/pitest/junit5/repository/TestSpecWithBeforeClass.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 @@ | ||
/* | ||
* Copyright 2023 Björn Kautler | ||
* | ||
* 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.pitest.junit5.repository | ||
|
||
import org.junit.BeforeClass | ||
import spock.lang.Specification | ||
|
||
class TestSpecWithBeforeClass extends Specification { | ||
@BeforeClass | ||
static beforeClass() { | ||
} | ||
|
||
def test() { | ||
expect: | ||
true | ||
|
||
where: | ||
i << (1..2) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/test/groovy/org/pitest/junit5/repository/TestSpecWithClassRuleField.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,33 @@ | ||
/* | ||
* Copyright 2023 Björn Kautler | ||
* | ||
* 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.pitest.junit5.repository | ||
|
||
import org.junit.ClassRule | ||
import spock.lang.Specification | ||
|
||
class TestSpecWithClassRuleField extends Specification { | ||
@ClassRule | ||
public static classRule | ||
|
||
def test() { | ||
expect: | ||
true | ||
|
||
where: | ||
i << (1..2) | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/test/groovy/org/pitest/junit5/repository/TestSpecWithClassRuleMethod.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 @@ | ||
/* | ||
* Copyright 2023 Björn Kautler | ||
* | ||
* 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.pitest.junit5.repository | ||
|
||
import org.junit.ClassRule | ||
import spock.lang.Specification | ||
|
||
class TestSpecWithClassRuleMethod extends Specification { | ||
@ClassRule | ||
static afterClass() { | ||
} | ||
|
||
def test() { | ||
expect: | ||
true | ||
|
||
where: | ||
i << (1..2) | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/test/groovy/org/pitest/junit5/repository/TestSpecWithSetupSpecWithoutShared.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,38 @@ | ||
/* | ||
* Copyright 2023 Björn Kautler | ||
* | ||
* 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.pitest.junit5.repository | ||
|
||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
|
||
class TestSpecWithSetupSpecWithoutShared extends Specification { | ||
static fail = true | ||
|
||
def setupSpec() { | ||
fail = false | ||
} | ||
|
||
def aTest() { | ||
expect: | ||
!fail | ||
} | ||
|
||
def anotherTest() { | ||
expect: | ||
!fail | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/test/groovy/org/pitest/junit5/repository/TestSpecWithShared.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,33 @@ | ||
/* | ||
* Copyright 2023 Björn Kautler | ||
* | ||
* 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.pitest.junit5.repository | ||
|
||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
|
||
class TestSpecWithShared extends Specification { | ||
@Shared | ||
foo | ||
|
||
def test() { | ||
expect: | ||
true | ||
|
||
where: | ||
i << (1..2) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/test/groovy/org/pitest/junit5/repository/TestSpecWithStepwise.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,31 @@ | ||
/* | ||
* Copyright 2023 Björn Kautler | ||
* | ||
* 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.pitest.junit5.repository | ||
|
||
import spock.lang.Specification | ||
import spock.lang.Stepwise | ||
|
||
@Stepwise | ||
class TestSpecWithStepwise extends Specification { | ||
def test() { | ||
expect: | ||
true | ||
|
||
where: | ||
i << (1..2) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/test/groovy/org/pitest/junit5/repository/TestSpecWithStepwiseFeature.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,31 @@ | ||
/* | ||
* Copyright 2023 Björn Kautler | ||
* | ||
* 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.pitest.junit5.repository | ||
|
||
import spock.lang.Specification | ||
import spock.lang.Stepwise | ||
|
||
class TestSpecWithStepwiseFeature extends Specification { | ||
@Stepwise | ||
def test() { | ||
expect: | ||
true | ||
|
||
where: | ||
i << (1..2) | ||
} | ||
} |
Oops, something went wrong.