> + Class<? extends Exception> expected) {
> + assertCodeMakes(method, uri, statusCode, message, "application/json",
> content, expected);
> + }
> +
> + private void assertCodeMakes(String method, URI uri, int statusCode,
> String message, String contentType,
> + String content, Class<? extends Exception> expected) {
> +
> + GoogleCloudStorageErrorHandler function = new
> GoogleCloudStorageErrorHandler();
> +
> + HttpCommand command = createMock(HttpCommand.class);
> + HttpRequest request =
> HttpRequest.builder().method(method).endpoint(uri).build();
> + HttpResponse response =
> HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
> + response.getPayload().getContentMetadata().setContentType(contentType);
> +
> + expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
> + command.setException(classEq(expected));
I mean, what is the purpose of this line? Perhaps I'm not understanding it, but
the exception should be set internally by the function being tested, not by the
code of the test? We are testing if the function sets the proper exception, so
we shouldn't be setting it beforehand. Could you explain the purpose of this
line, in case I'm not getting it?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/33/files#r14909233