> +                  .build());
> +      Set<CookbookDefinition> cookbooks = 
> api.listCookbooksInEnvironment("dev");
> +      assertEquals(cookbooks.size(), 2);
> +   }
> +
> +   public void testListCookbooksInEnvironmentReturns404() {
> +      ChefApi api = requestSendsResponse(
> +            signed(HttpRequest.builder() //
> +                  .method("GET") //
> +                  
> .endpoint("http://localhost:4000/environments/dev/cookbooks";) //
> +                  .addHeader("X-Chef-Version", 
> ChefApiMetadata.DEFAULT_API_VERSION) //
> +                  .addHeader("Accept", MediaType.APPLICATION_JSON).build()), 
> //
> +            HttpResponse.builder().statusCode(404)
> +                  .build());
> +      Set<CookbookDefinition> cookbooks = 
> api.listCookbooksInEnvironment("dev");
> +      assertNull(cookbooks);

Just noticed this when reading the Expect test. It is not related to this pull 
request, but `list` methods should never return `null` ([null is 
evil](https://code.google.com/p/guava-libraries/wiki/UsingAndAvoidingNullExplained)
 and we try to avoid using it in jclouds). [This response 
parser](https://github.com/jclouds/jclouds-chef/blob/master/core/src/main/java/org/jclouds/chef/ChefApi.java#L203)
 should be changed to `EmptySetOnNotFoundOr404`, to behave as all other list 
methods. Do you want to take this too?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/24/files#r6425878

Reply via email to