> + 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");
I am not following completely. The success path is tested in
testCreateSecurityGroup
In here, the test would throw an exception at create, and the test will end
successfully.
If it does not throw an exception, the test fails anyways (the explicit fail is
mostly for documentation and is redundant).
In fact it might make more sense to remove the fail here.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-openstack/pull/132/files#r16733610