Fixed the tests
This commit is contained in:
@@ -246,8 +246,9 @@ public class GenerateTestsMojo extends AbstractMojo {
|
||||
getLog().info(
|
||||
"Test Source directory: " + this.generatedTestSourcesDir.getAbsolutePath()
|
||||
+ " added.");
|
||||
getLog().info("Using " + config.getBaseClassForTests()
|
||||
+ " as base class for test classes");
|
||||
getLog().info("Using [" + config.getBaseClassForTests()
|
||||
+ "] as base class for test classes, [" + config.getBasePackageForTests() + "] as base "
|
||||
+ "package for tests, [" + config.getPackageWithBaseClasses() + "] as package with base classes");
|
||||
}
|
||||
try {
|
||||
TestGenerator generator = new TestGenerator(config);
|
||||
|
||||
@@ -248,80 +248,80 @@ class YamlContractConverterSpec extends Specification {
|
||||
RegexPatterns patterns = new RegexPatterns()
|
||||
contract.input.messageHeaders.entries.find { it.name == "contentType" &&
|
||||
((Pattern) it.clientValue).pattern == "application/json.*" && it.serverValue == "application/json" }
|
||||
contract.input.matchers.jsonPathRegexMatchers[0].path() == '$.duck'
|
||||
contract.input.matchers.jsonPathRegexMatchers[0].matchingType() == MatchingType.REGEX
|
||||
contract.input.matchers.jsonPathRegexMatchers[0].value() == '[0-9]{3}'
|
||||
contract.input.matchers.jsonPathRegexMatchers[1].path() == '$.duck'
|
||||
contract.input.matchers.jsonPathRegexMatchers[1].matchingType() == MatchingType.EQUALITY
|
||||
contract.input.matchers.jsonPathRegexMatchers[2].path() == '$.alpha'
|
||||
contract.input.matchers.jsonPathRegexMatchers[2].matchingType() == MatchingType.REGEX
|
||||
contract.input.matchers.jsonPathRegexMatchers[2].value() == patterns.onlyAlphaUnicode()
|
||||
contract.input.matchers.jsonPathRegexMatchers[3].path() == '$.alpha'
|
||||
contract.input.matchers.jsonPathRegexMatchers[3].matchingType() == MatchingType.EQUALITY
|
||||
contract.input.matchers.jsonPathRegexMatchers[4].path() == '$.number'
|
||||
contract.input.matchers.jsonPathRegexMatchers[4].matchingType() == MatchingType.REGEX
|
||||
contract.input.matchers.jsonPathRegexMatchers[4].value() == patterns.number()
|
||||
contract.input.matchers.jsonPathRegexMatchers[5].path() == '$.aBoolean'
|
||||
contract.input.matchers.jsonPathRegexMatchers[5].matchingType() == MatchingType.REGEX
|
||||
contract.input.matchers.jsonPathRegexMatchers[5].value() == patterns.anyBoolean()
|
||||
contract.input.matchers.jsonPathRegexMatchers[6].path() == '$.date'
|
||||
contract.input.matchers.jsonPathRegexMatchers[6].matchingType() == MatchingType.DATE
|
||||
contract.input.matchers.jsonPathRegexMatchers[6].value() == patterns.isoDate()
|
||||
contract.input.matchers.jsonPathRegexMatchers[7].path() == '$.dateTime'
|
||||
contract.input.matchers.jsonPathRegexMatchers[7].matchingType() == MatchingType.TIMESTAMP
|
||||
contract.input.matchers.jsonPathRegexMatchers[7].value() == patterns.isoDateTime()
|
||||
contract.input.matchers.jsonPathRegexMatchers[8].path() == '$.time'
|
||||
contract.input.matchers.jsonPathRegexMatchers[8].matchingType() == MatchingType.TIME
|
||||
contract.input.matchers.jsonPathRegexMatchers[8].value() == patterns.isoTime()
|
||||
contract.input.matchers.jsonPathRegexMatchers[9].path() == "\$.['key'].['complex.key']"
|
||||
contract.input.matchers.jsonPathRegexMatchers[9].matchingType() == MatchingType.EQUALITY
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[0].path() == '$.duck'
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[0].matchingType() == MatchingType.REGEX
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[0].value() == '[0-9]{3}'
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[1].path() == '$.duck'
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[1].matchingType() == MatchingType.EQUALITY
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[2].path() == '$.alpha'
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[2].matchingType() == MatchingType.REGEX
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[2].value() == patterns.onlyAlphaUnicode().pattern()
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[3].path() == '$.alpha'
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[3].matchingType() == MatchingType.EQUALITY
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[4].path() == '$.number'
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[4].matchingType() == MatchingType.REGEX
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[4].value() == patterns.number().pattern()
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[5].path() == '$.aBoolean'
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[5].matchingType() == MatchingType.REGEX
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[5].value() == patterns.anyBoolean().pattern()
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[6].path() == '$.date'
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[6].matchingType() == MatchingType.DATE
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[6].value() == patterns.isoDate()
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[7].path() == '$.dateTime'
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[7].matchingType() == MatchingType.TIMESTAMP
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[7].value() == patterns.isoDateTime()
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[8].path() == '$.time'
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[8].matchingType() == MatchingType.TIME
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[8].value() == patterns.isoTime()
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[9].path() == "\$.['key'].['complex.key']"
|
||||
contract.input.bodyMatchers.jsonPathRegexMatchers[9].matchingType() == MatchingType.EQUALITY
|
||||
and:
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[0].path() == '$.duck'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[0].matchingType() == MatchingType.REGEX
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[0].value() == '[0-9]{3}'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[1].path() == '$.duck'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[1].matchingType() == MatchingType.EQUALITY
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[2].path() == '$.alpha'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[2].matchingType() == MatchingType.REGEX
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[2].value() == patterns.onlyAlphaUnicode()
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[3].path() == '$.alpha'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[3].matchingType() == MatchingType.EQUALITY
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[4].path() == '$.number'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[4].matchingType() == MatchingType.REGEX
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[4].value() == patterns.number()
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[5].path() == '$.aBoolean'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[5].matchingType() == MatchingType.REGEX
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[5].value() == patterns.anyBoolean()
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[6].path() == '$.date'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[6].matchingType() == MatchingType.DATE
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[6].value() == patterns.isoDate()
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[7].path() == '$.dateTime'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[7].matchingType() == MatchingType.TIMESTAMP
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[7].value() == patterns.isoDateTime()
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[8].path() == '$.time'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[8].matchingType() == MatchingType.TIME
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[8].value() == patterns.isoTime()
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[9].path() == '$.valueWithTypeMatch'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[9].matchingType() == MatchingType.TYPE
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[10].path() == '$.valueWithMin'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[10].matchingType() == MatchingType.TYPE
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[10].minTypeOccurrence() == 1
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[11].path() == '$.valueWithMax'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[11].matchingType() == MatchingType.TYPE
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[11].maxTypeOccurrence() == 3
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[12].path() == '$.valueWithMinMax'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[12].matchingType() == MatchingType.TYPE
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[12].minTypeOccurrence() == 1
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[12].maxTypeOccurrence() == 3
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[13].path() == '$.valueWithMinEmpty'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[13].matchingType() == MatchingType.TYPE
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[13].minTypeOccurrence() == 0
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[14].path() == '$.valueWithMaxEmpty'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[14].matchingType() == MatchingType.TYPE
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[14].maxTypeOccurrence() == 0
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[15].path() == '$.duck'
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[15].matchingType() == MatchingType.COMMAND
|
||||
contract.outputMessage.matchers.jsonPathRegexMatchers[15].value() == new ExecutionProperty('assertThatValueIsANumber($it)')
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[0].path() == '$.duck'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[0].matchingType() == MatchingType.REGEX
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[0].value() == '[0-9]{3}'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[1].path() == '$.duck'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[1].matchingType() == MatchingType.EQUALITY
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[2].path() == '$.alpha'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[2].matchingType() == MatchingType.REGEX
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[2].value() == patterns.onlyAlphaUnicode().pattern()
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[3].path() == '$.alpha'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[3].matchingType() == MatchingType.EQUALITY
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[4].path() == '$.number'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[4].matchingType() == MatchingType.REGEX
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[4].value() == patterns.number().pattern()
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[5].path() == '$.aBoolean'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[5].matchingType() == MatchingType.REGEX
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[5].value() == patterns.anyBoolean().pattern()
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[6].path() == '$.date'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[6].matchingType() == MatchingType.DATE
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[6].value() == patterns.isoDate()
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[7].path() == '$.dateTime'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[7].matchingType() == MatchingType.TIMESTAMP
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[7].value() == patterns.isoDateTime()
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[8].path() == '$.time'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[8].matchingType() == MatchingType.TIME
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[8].value() == patterns.isoTime()
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[9].path() == '$.valueWithTypeMatch'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[9].matchingType() == MatchingType.TYPE
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[10].path() == '$.valueWithMin'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[10].matchingType() == MatchingType.TYPE
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[10].minTypeOccurrence() == 1
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[11].path() == '$.valueWithMax'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[11].matchingType() == MatchingType.TYPE
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[11].maxTypeOccurrence() == 3
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[12].path() == '$.valueWithMinMax'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[12].matchingType() == MatchingType.TYPE
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[12].minTypeOccurrence() == 1
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[12].maxTypeOccurrence() == 3
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[13].path() == '$.valueWithMinEmpty'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[13].matchingType() == MatchingType.TYPE
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[13].minTypeOccurrence() == 0
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[14].path() == '$.valueWithMaxEmpty'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[14].matchingType() == MatchingType.TYPE
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[14].maxTypeOccurrence() == 0
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[15].path() == '$.duck'
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[15].matchingType() == MatchingType.COMMAND
|
||||
contract.outputMessage.bodyMatchers.jsonPathRegexMatchers[15].value() == new ExecutionProperty('assertThatValueIsANumber($it)')
|
||||
}
|
||||
|
||||
def "should convert YAML with REST with response from request"() {
|
||||
|
||||
Reference in New Issue
Block a user