public void testCode7021SetsDirectionalGroupOverlapException() throws IOException {
HttpRequest request = HttpRequest.builder().method(POST)
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
.addHeader(HOST, "ultra-api.ultradns.com:8443")
.payload(payloadFromResource("/create_directionalrecord_newgroup.xml")).build();
HttpCommand command = new HttpCommand(request);
HttpResponse response = HttpResponse.builder()
.message(INTERNAL_SERVER_ERROR.getReasonPhrase())
.statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
.payload(payloadFromResource("/directionalgroup_overlap.xml")).build();
function.handleError(command, response);
assertEquals(command.getException().getClass(), DirectionalGroupOverlapException.class);
assertEquals(command.getException().getMessage(), "Geolocation/Source IP overlap(s) found: Region: Utah (Group: US )");
UltraDNSWSResponseException exception = UltraDNSWSResponseException.class.cast(command.getException().getCause());
assertEquals(exception.getMessage(), "Error 7021: Geolocation/Source IP overlap(s) found: Region: Utah (Group: US )");
assertEquals(exception.getError().getDescription().get(), "Geolocation/Source IP overlap(s) found: Region: Utah (Group: US )");
assertEquals(exception.getError().getCode(), 7021);
}