Test suffix is used also in class name

(not only in file name)
This commit is contained in:
Marcin Zajaczkowski
2015-02-24 13:13:43 +01:00
parent cbf82e7d73
commit 209f3ce2a0
5 changed files with 7 additions and 7 deletions

View File

@@ -28,8 +28,7 @@ class FileSaver {
Path testBaseDir = Paths.get(targetDirectory.absolutePath, NamesUtil.packageToDirectory(packageName))
Files.createDirectories(testBaseDir)
Path classPath = Paths.get(testBaseDir.toString(), capitalize(fileName) + framework.classNameSuffix + framework.classExtension)
.toAbsolutePath()
Path classPath = Paths.get(testBaseDir.toString(), capitalize(fileName) + framework.classExtension).toAbsolutePath()
log.info("Creating new class file [$classPath]")
Files.write(classPath, classBytes, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)
}

View File

@@ -62,7 +62,7 @@ class TestGenerator {
return new File(configProperties.contractsDslDir, it)
}
if (filesToClass.size()) {
def className = afterLast(includedDirectoryRelativePath, File.separator)
def className = afterLast(includedDirectoryRelativePath, File.separator) + configProperties.targetFramework.classNameSuffix
def classBytes = generator.buildClass(filesToClass, className, packageNameForClass).bytes
saver.saveClassFile(className, packageNameForClass, classBytes)
counter.incrementAndGet()

View File

@@ -32,7 +32,7 @@ class TestGeneratorSpec extends Specification {
when:
testGenerator.generateTestClasses("com.ofg")
then:
1 * classGenerator.buildClass(_, 'different', _) >> "qwerty"
1 * classGenerator.buildClass(_, 'differentSpec', _) >> "qwerty"
}
def "should ignore file"() {
@@ -46,6 +46,6 @@ class TestGeneratorSpec extends Specification {
when:
testGenerator.generateTestClasses("com.ofg")
then:
1 * classGenerator.buildClass({ it.size() == 1 }, 'other', _) >> "sample.groovy"
1 * classGenerator.buildClass({ it.size() == 1 }, 'otherSpec', _) >> "sample.groovy"
}
}

View File

@@ -13,7 +13,7 @@ class BasicFunctionalSpec extends IntegrationSpec {
then:
fileExists('build.gradle')
when:
def result = runTasksSuccessfully('check')
def result = runTasksSuccessfully('clean', 'check') //clean to remove accidental output when importing SimpleBoot into Idea
then:
result.wasExecuted(":generateWiremockClientStubs")
result.wasExecuted(":generateAccurest")
@@ -25,7 +25,7 @@ class BasicFunctionalSpec extends IntegrationSpec {
fileExists("build/production/bootSimple-stubs/repository/mappings/pairId/colleratePlacesFromTweet.json")
and: "generated tests executed"
fileExists("build/test-results/TEST-accurest.PairId.xml")
fileExists("build/test-results/TEST-accurest.PairIdSpec.xml")
}
def "should generate valid client json stubs for simple input"() {

View File

@@ -0,0 +1 @@
rootProject.name='bootSimple'