Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cts): assert that exceptions are thrown #2713

Merged
merged 3 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/java/tests/client/suite.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class {{client}}ClientTests {
assertEquals("{{{match}}}", result.host);
{{/testHost}}
{{#testResponse}}
assertDoesNotThrow(() -> JSONAssert.assertEquals("{{#lambda.escapeQuotes}}{{{match.parameters}}}{{/lambda.escapeQuotes}}", json.writeValueAsString(res), JSONCompareMode.STRICT));
assertDoesNotThrow(() -> JSONAssert.assertEquals("{{#lambda.escapeQuotes}}{{{match.parameters}}}{{/lambda.escapeQuotes}}", json.writeValueAsString(res), JSONCompareMode.STRICT));
{{/testResponse}}
{{/match}}
{{/isError}}
Expand Down
1 change: 1 addition & 0 deletions templates/php/tests/client/suite.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class {{clientPrefix}}Test extends TestCase implements HttpClientInterface
{{#isError}}
try {
{{#dynamicTemplate}}{{/dynamicTemplate}}
$this->fail('Expected exception to be thrown');
} catch (\Exception $e) {
$this->assertEquals($e->getMessage(), '{{{expectedError}}}');
}
Expand Down
1 change: 1 addition & 0 deletions templates/python/tests/client/suite.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Test{{#lambda.pascalcase}}{{{client}}}{{/lambda.pascalcase}}:
{{#isError}}
try:
{{#dynamicTemplate}}{{/dynamicTemplate}}
assert False
except (ValueError, Exception) as e:
assert str(e) == {{#lambda.codeSnakeCase}}"{{{expectedError}}}"{{/lambda.codeSnakeCase}}
{{/isError}}
Expand Down
1 change: 1 addition & 0 deletions templates/ruby/tests/client/suite.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class TestClient{{#lambda.pascalcase}}{{{client}}}{{/lambda.pascalcase}} < Test:
{{#isError}}
begin
{{#dynamicTemplate}}{{/dynamicTemplate}}
assert(false, 'An error should have been raised')
rescue => e
assert_equal({{#lambda.codeSnakeCase}}'{{{expectedError}}}'{{/lambda.codeSnakeCase}}, e.message)
end
Expand Down
Loading