> + public void testCreateSecurityGroupFail() throws IOException,
> InterruptedException, URISyntaxException {
> + MockWebServer server = mockOpenStackServer();
> + server.enqueue(addCommonHeaders(new
> MockResponse().setBody(stringFromResource("/access.json"))));
> + server.enqueue(addCommonHeaders(
> + new MockResponse().setResponseCode(404)));
> +
> + try {
> + NeutronApi neutronApi = api(server.getUrl("/").toString(),
> "openstack-neutron", overrides);
> + SecurityGroupApi api =
> neutronApi.getSecurityGroupApi("RegionOne").get();
> +
> + SecurityGroup.CreateOptions createSecurityGroup =
> SecurityGroup.createOptions().name("new-webservers")
> + .description("security group for webservers")
> + .build();
> +
> + SecurityGroup securityGroup = api.create(createSecurityGroup);
> + fail("Should have failed with not found exception");
Yep, very bad explained :) I meant to add a try/catch and assert the generated
request in the catch block, just to make the test complete and independent: the
request was properly generated and resulted in an exception. Just like in the
other test where you assert the generated request, and then the produced
result, this test should also be complete and test the same: the generated
request and the produced result.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-openstack/pull/132/files#r16746465