Added compilation test to cookie assertion tests
This commit is contained in:
@@ -1267,6 +1267,8 @@ DATA
|
||||
test.contains('''.cookie("cookie-key", "cookie-value")''')
|
||||
test.contains('''assertThat(response.getCookies().get("cookie-key")).isNotNull();''')
|
||||
test.contains('''assertThat(response.getCookies().get("cookie-key").getValue()).isEqualTo("new-cookie-value");''')
|
||||
and:
|
||||
SyntaxChecker.tryToCompile("JaxRsClientJUnitMethodBodyBuilder", blockBuilder.toString())
|
||||
}
|
||||
|
||||
def "should generate test for cookies with pattern in JAX-RS JUnit test"() {
|
||||
@@ -1280,6 +1282,8 @@ DATA
|
||||
test.contains('''.cookie("cookie-key", "[A-Za-z]+")''')
|
||||
test.contains('''assertThat(response.getCookies().get("cookie-key")).isNotNull();''')
|
||||
test.contains('''assertThat(response.getCookies().get("cookie-key").getValue()).matches("[A-Za-z]+");''')
|
||||
and:
|
||||
SyntaxChecker.tryToCompile("JaxRsClientJUnitMethodBodyBuilder", blockBuilder.toString())
|
||||
}
|
||||
|
||||
def "should generate test for cookies with string value in JAX-RS Spock test"() {
|
||||
@@ -1293,6 +1297,8 @@ DATA
|
||||
test.contains('''.cookie('cookie-key', 'cookie-value')''')
|
||||
test.contains('''response.getCookies().get('cookie-key') != null''')
|
||||
test.contains("response.getCookies().get('cookie-key').getValue() == 'new-cookie-value'")
|
||||
and:
|
||||
SyntaxChecker.tryToCompile("JaxRsClientSpockMethodRequestProcessingBodyBuilder", blockBuilder.toString())
|
||||
}
|
||||
|
||||
def "should generate test for cookies with pattern in JAX-RS Spock test"() {
|
||||
@@ -1306,5 +1312,7 @@ DATA
|
||||
test.contains('''.cookie('cookie-key', '[A-Za-z]+')''')
|
||||
test.contains('''response.getCookies().get('cookie-key') != null''')
|
||||
test.contains('''response.getCookies().get('cookie-key').getValue() ==~ java.util.regex.Pattern.compile('[A-Za-z]+')''')
|
||||
and:
|
||||
SyntaxChecker.tryToCompile("JaxRsClientSpockMethodRequestProcessingBodyBuilder", blockBuilder.toString())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2472,6 +2472,8 @@ DocumentContext parsedJson = JsonPath.parse(json);
|
||||
test.contains('''.cookie("cookie-key", "cookie-value")''')
|
||||
test.contains('''assertThat(response.getCookie("cookie-key")).isNotNull();''')
|
||||
test.contains('''assertThat(response.getCookie("cookie-key")).isEqualTo("new-cookie-value");''')
|
||||
and:
|
||||
SyntaxChecker.tryToCompile("MockMvcJUnitMethodBodyBuilder", blockBuilder.toString())
|
||||
}
|
||||
|
||||
def "should generate JUnit assertions with cookies pattern"() {
|
||||
@@ -2485,6 +2487,8 @@ DocumentContext parsedJson = JsonPath.parse(json);
|
||||
test.contains('''.cookie("cookie-key", "[A-Za-z]+")''')
|
||||
test.contains('''assertThat(response.getCookie("cookie-key")).isNotNull();''')
|
||||
test.contains('''assertThat(response.getCookie("cookie-key")).matches("[A-Za-z]+");''')
|
||||
and:
|
||||
SyntaxChecker.tryToCompile("MockMvcJUnitMethodBodyBuilder", blockBuilder.toString())
|
||||
}
|
||||
|
||||
def "should generate spock assertions with cookies"() {
|
||||
@@ -2498,6 +2502,8 @@ DocumentContext parsedJson = JsonPath.parse(json);
|
||||
test.contains('''.cookie("cookie-key", "cookie-value")''')
|
||||
test.contains('''response.cookie('cookie-key') != null''')
|
||||
test.contains('''response.cookie('cookie-key') == 'new-cookie-value''')
|
||||
and:
|
||||
SyntaxChecker.tryToCompile("MockMvcSpockMethodRequestProcessingBodyBuilder", blockBuilder.toString())
|
||||
}
|
||||
|
||||
def "should generate spock assertions with cookies pattern"() {
|
||||
@@ -2511,6 +2517,8 @@ DocumentContext parsedJson = JsonPath.parse(json);
|
||||
test.contains('''.cookie("cookie-key", "[A-Za-z]+")''')
|
||||
test.contains('''response.cookie('cookie-key') != null''')
|
||||
test.contains('''response.cookie('cookie-key') ==~ java.util.regex.Pattern.compile('[A-Za-z]+')''')
|
||||
and:
|
||||
SyntaxChecker.tryToCompile("MockMvcSpockMethodRequestProcessingBodyBuilder", blockBuilder.toString())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user