org.trustedanalytics.user.common.UaaProblemReaderTest.java Source code

Java tutorial

Introduction

Here is the source code for org.trustedanalytics.user.common.UaaProblemReaderTest.java

Source

/**
 *  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.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.web.client.HttpClientErrorException;

import java.util.UUID;

public class UaaProblemReaderTest {

    @Test
    public void test_read() {
        UUID userId = UUID.randomUUID();
        HttpClientErrorException exception = TestUtils.createDummyHttpClientException(userId);
        UaaProblem expectedError = new UaaProblem("Username already in use: test@example.com",
                "scim_resource_already_exists", userId.toString());
        Assert.assertThat(UaaProblemReader.read(exception), CoreMatchers.equalTo(expectedError));
    }
}