Package com.nimbusds.oauth2.sdk.client

Source Code of com.nimbusds.oauth2.sdk.client.ClientDeleteRequestTest

package com.nimbusds.oauth2.sdk.client;


import java.net.URL;

import junit.framework.TestCase;

import com.nimbusds.oauth2.sdk.ParseException;
import com.nimbusds.oauth2.sdk.http.HTTPRequest;
import com.nimbusds.oauth2.sdk.token.BearerTokenError;


/**
* Tests the client delete request.
*/
public class ClientDeleteRequestTest extends TestCase {


  public void testParseWithMissingAuthorizationHeader()
    throws Exception {

    HTTPRequest httpRequest = new HTTPRequest(HTTPRequest.Method.DELETE, new URL("https://c2id.com/client-reg/123"));

    try {
      ClientDeleteRequest.parse(httpRequest);

      fail();

    } catch (ParseException e) {

      assertTrue(e.getErrorObject() instanceof BearerTokenError);

      BearerTokenError bte = (BearerTokenError)e.getErrorObject();

      assertEquals(401, bte.getHTTPStatusCode());
      assertNull(bte.getCode());
      assertEquals("Bearer", bte.toWWWAuthenticateHeader());
    }
  }
}
TOP

Related Classes of com.nimbusds.oauth2.sdk.client.ClientDeleteRequestTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.