Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pmendelski committed Oct 13, 2024
1 parent 3b83798 commit 1f763b9
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 83 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ ktlint_code_style = intellij_idea
ktlint_function_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = unset
ktlint_ignore_back_ticked_identifier = true
ktlint_function_signature_body_expression_wrapping = default
ktlint_standard_function-expression-body = disabled
ktlint_standard_function-expression-body = disabled
ktlint_standard_class-signature = disabled
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Junit4BasedAcceptanceTest {
dependencies {
testImplementation "junit:junit:4.13.2"
// sample integration test dependency
integrationTestImplementation "com.coditory.quark:quark-context:0.1.22"
integrationTestImplementation "org.slf4j:slf4j-api:2.0.16"
}
test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Junit5BasedAcceptanceTest {
testImplementation "org.junit.jupiter:junit-jupiter-api:5.11.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.11.0"
// sample integration test dependency
integrationTestImplementation "com.coditory.quark:quark-context:0.1.22"
integrationTestImplementation "org.slf4j:slf4j-api:2.0.16"
}
test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class KotlinInternalScopeAcceptanceTest {
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.11.0")
// sample integration test dependency
integrationTestImplementation("com.coditory.quark:quark-context:0.1.22")
integrationTestImplementation("org.slf4j:slf4j-api:2.0.16")
}
tasks.withType<Test> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,121 +14,121 @@ class SpockBasedAcceptanceTest {
project("sample-project")
.withBuildGradle(
"""
plugins {
id 'groovy'
id 'com.coditory.integration-test'
}
plugins {
id 'groovy'
id 'com.coditory.integration-test'
}
repositories {
mavenCentral()
}
repositories {
mavenCentral()
}
dependencies {
testImplementation "org.spockframework:spock-core:2.4-M4-groovy-4.0"
// sample integration test dependency
integrationTestImplementation "com.coditory.quark:quark-context:0.1.22"
}
dependencies {
testImplementation "org.spockframework:spock-core:2.4-M4-groovy-4.0"
// sample integration test dependency
integrationTestImplementation "org.slf4j:slf4j-api:2.0.16"
}
test {
testLogging {
events("passed", "failed", "skipped")
setExceptionFormat("full")
test {
testLogging {
events("passed", "failed", "skipped")
setExceptionFormat("full")
}
}
}
""",
""",
).withFile(
"src/test/groovy/ClasspathFileReader.groovy",
"""
class ClasspathFileReader {
static String readFile(String name) throws Exception {
return ClasspathFileReader.class.getResource("/" + name).getText()
class ClasspathFileReader {
static String readFile(String name) throws Exception {
return ClasspathFileReader.class.getResource("/" + name).getText()
}
}
}
""",
""",
).withFile(
"src/test/groovy/ConstantValues.groovy",
"""
class ConstantValues {
static final String MODULE = "test"
}
""",
class ConstantValues {
static final String MODULE = "test"
}
""",
).withFile(
"src/integrationTest/groovy/ConstantValues.groovy",
"""
class ConstantValues {
static final String MODULE = "integration"
}
""",
class ConstantValues {
static final String MODULE = "integration"
}
""",
).withFile(
"src/main/java/ConstantValues.java",
"""
public class ConstantValues {
public static final String MODULE = "main";
}
""",
public class ConstantValues {
public static final String MODULE = "main";
}
""",
).withFile(
"src/main/java/MainConstantValues.java",
"""
public class MainConstantValues {
public static final String MODULE = "main";
}
""",
public class MainConstantValues {
public static final String MODULE = "main";
}
""",
).withFile(
"src/integrationTest/groovy/TestIntgSpec.groovy",
"""
import spock.lang.Specification
import static ClasspathFileReader.readFile
import spock.lang.Specification
import static ClasspathFileReader.readFile
class TestIntgSpec extends Specification {
def "should read a.txt from main"() {
expect:
readFile('a.txt') == 'main-a'
}
class TestIntgSpec extends Specification {
def "should read a.txt from main"() {
expect:
readFile('a.txt') == 'main-a'
}
def "should read b.txt from test"() {
expect:
readFile('b.txt') == 'test-b'
}
def "should read b.txt from test"() {
expect:
readFile('b.txt') == 'test-b'
}
def "should read c.txt from test"() {
expect:
readFile('c.txt') == 'integration-c'
}
def "should read c.txt from test"() {
expect:
readFile('c.txt') == 'integration-c'
}
def "should read constant value from integration module"() {
expect:
ConstantValues.MODULE == 'integration'
}
def "should read constant value from integration module"() {
expect:
ConstantValues.MODULE == 'integration'
}
def "should read main constant value from main module"() {
expect:
MainConstantValues.MODULE == 'main'
def "should read main constant value from main module"() {
expect:
MainConstantValues.MODULE == 'main'
}
}
}
""",
""",
).withFile(
"src/test/groovy/TestUnitSpec.groovy",
"""
import spock.lang.Specification
import static ClasspathFileReader.readFile
import spock.lang.Specification
import static ClasspathFileReader.readFile
class TestUnitSpec extends Specification {
def "should read a.txt from main"() {
expect:
readFile('a.txt') == 'main-a'
}
class TestUnitSpec extends Specification {
def "should read a.txt from main"() {
expect:
readFile('a.txt') == 'main-a'
}
def "should read b.txt from test"() {
expect:
readFile('b.txt') == 'test-b'
}
def "should read b.txt from test"() {
expect:
readFile('b.txt') == 'test-b'
}
def "should read constant value from test module"() {
expect:
ConstantValues.MODULE == 'test'
def "should read constant value from test module"() {
expect:
ConstantValues.MODULE == 'test'
}
}
}
""",
""",
).withFile("src/main/resources/a.txt", "main-a")
.withFile("src/main/resources/b.txt", "main-b")
.withFile("src/main/resources/c.txt", "main-c")
Expand Down

0 comments on commit 1f763b9

Please sign in to comment.