}
@Test
public void testGetNetworkHrefInvalidId() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
get.toBuilder().endpoint(endpoint + "/network/NOTAUUID").build(),
HttpResponse.builder()
.statusCode(400)
.payload(payloadFromResourceWithContentType("/network/error400.xml", ERROR + ";version=1.5"))
.build());
Error expected = Error.builder()
.message("validation error : EntityRef has incorrect type, expected type is com.vmware.vcloud.entity.network.")
.majorErrorCode(400)
.minorErrorCode("BAD_REQUEST")
.build();
try {
api.getNetworkApi().get(URI.create(endpoint + "/network/NOTAUUID"));
fail("Should give HTTP 400 error");
} catch (VCloudDirectorException vde) {
assertEquals(vde.getError(), expected);
} catch (Exception e) {
fail("Should have thrown a VCloudDirectorException");