Java tutorial
/** * Copyright(c)2015 IntelCorporation * * LicensedundertheApacheLicense,Version2.0(the"License"); * youmaynotusethisfileexceptincompliancewiththeLicense. * YoumayobtainacopyoftheLicenseat * * http://www.apache.org/licenses/LICENSE-2.0 * * Unlessrequiredbyapplicablelaworagreedtoinwriting,software * distributedundertheLicenseisdistributedonan"ASIS"BASIS, * WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied. * SeetheLicenseforthespecificlanguagegoverningpermissionsand * limitationsundertheLicense. */ package org.trustedanalytics.user.common; import org.springframework.http.HttpStatus; import org.springframework.web.client.HttpClientErrorException; import java.nio.charset.Charset; import java.util.UUID; public class TestUtils { public static HttpClientErrorException createDummyHttpClientException(UUID userId) { String body = "{\"message\":\"Username already in use: test@example.com\",\"error\":\"scim_resource_already_exists\",\"verified\":false,\"active\":true,\"user_id\":\"" + userId + "\"}"; HttpClientErrorException exception = new HttpClientErrorException(HttpStatus.CONFLICT, "Conflict", body.getBytes(), Charset.defaultCharset()); return exception; } }