Accurest is now able to override existing file

This commit is contained in:
Jakub Kubrynski
2015-01-29 00:36:06 +01:00
parent 76ffce6fc4
commit 60ad4d2c11
2 changed files with 2 additions and 2 deletions

View File

@@ -50,7 +50,7 @@ class TestGenerator {
Files.createDirectories(testBaseDir)
def classPath = Paths.get(testBaseDir.toString(), capitalize(it.name) + getTestClassExtension()).toAbsolutePath()
def classBytes = buildClass(it, packageName).bytes
Files.write(classPath, classBytes, StandardOpenOption.CREATE)
Files.write(classPath, classBytes, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)
}
}
}

View File

@@ -25,7 +25,7 @@ class SpockMethodBodyBuilder {
if (stubDefinition.request.bodyPatterns) {
String matches = stubDefinition.request.bodyPatterns[0].matches
matches = matches.replaceAll('\\\\', '');
blockBuilder.addLine(".body('${JsonOutput.toJson(matches)}')")
blockBuilder.addLine(".body('$matches')")
}
blockBuilder.unindent().endBlock().addEmptyLine()