Fixed Jaxrs imports for JUnit in SingleTestGenerator.
This commit is contained in:
@@ -53,7 +53,7 @@ class SingleTestGenerator {
|
||||
if (configProperties.testMode == TestMode.JAXRSCLIENT) {
|
||||
clazz.addStaticImport('javax.ws.rs.client.Entity.*')
|
||||
if (configProperties.targetFramework == TestFramework.JUNIT) {
|
||||
clazz.addImport('import javax.ws.rs.core.Response')
|
||||
clazz.addImport('javax.ws.rs.core.Response')
|
||||
}
|
||||
} else if (configProperties.testMode == TestMode.MOCKMVC) {
|
||||
clazz.addStaticImport('com.jayway.restassured.module.mockmvc.RestAssuredMockMvc.*')
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.codearte.accurest
|
||||
|
||||
import io.codearte.accurest.config.AccurestConfigProperties
|
||||
import io.codearte.accurest.config.TestMode
|
||||
import io.codearte.accurest.file.Contract
|
||||
import org.junit.Rule
|
||||
import org.junit.rules.TemporaryFolder
|
||||
@@ -67,6 +68,7 @@ class SingleTestGeneratorSpec extends Specification {
|
||||
def "should build JaxRs test class for #testFramework"() {
|
||||
given:
|
||||
AccurestConfigProperties properties = new AccurestConfigProperties();
|
||||
properties.testMode = TestMode.JAXRSCLIENT
|
||||
properties.targetFramework = testFramework
|
||||
Contract contract = new Contract(file.toPath(), true, 1, 2)
|
||||
contract.ignored >> true
|
||||
@@ -81,8 +83,8 @@ class SingleTestGeneratorSpec extends Specification {
|
||||
|
||||
where:
|
||||
testFramework | classStrings
|
||||
JUNIT | jUnitClassStrings
|
||||
SPOCK | spockClassStrings
|
||||
JUNIT | ['import static javax.ws.rs.client.Entity.*;', 'import javax.ws.rs.core.Response;']
|
||||
SPOCK | ['import static javax.ws.rs.client.Entity.*;']
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user