// Path: src/main/java/jp/eisbahn/oauth2/server/fetcher/accesstoken/AccessTokenFetcher.java
// public static class FetchResult {
// 
// 	private String token;
// 	private Map<String, String> params;
// 
// 	/**
// 	 * This constructor initializes like both parameters become a null value.
// 	 */
// 	public FetchResult() {
// 		this(null, null);
// 	}
// 
// 	/**
// 	 * This constructor initializes with the specified argument values.
// 	 * @param token The access token string.
// 	 * @param params Other parameters.
// 	 */
// 	public FetchResult(String token, Map<String, String> params) {
// 		super();
// 		this.token = token;
// 		this.params = params;
// 	}
// 
// 	/**
// 	 * Set the access token.
// 	 * @param token The token string.
// 	 */
// 	public void setToken(String token) {
// 		this.token = token;
// 	}
// 
// 	/**
// 	 * Retrieve the access token.
// 	 * @return The token string.
// 	 */
// 	public String getToken() {
// 		return token;
// 	}
// 
// 	/**
// 	 * Set other parameters.
// 	 * @param params The other parameter map object.
// 	 */
// 	public void setParams(Map<String, String> params) {
// 		this.params = params;
// 	}
// 
// 	/**
// 	 * Retrieve the other parameters.
// 	 * @return The other parameter map object.
// 	 */
// 	public Map<String, String> getParams() {
// 		return params;
// 	}
// 
// }
// 
// Path: src/main/java/jp/eisbahn/oauth2/server/fetcher/accesstoken/impl/RequestParameter.java
// public class RequestParameter implements AccessTokenFetcher {
// 
// 	/**
// 	 * Return whether an access token is included in the request parameter's
// 	 * values. Actually, this method confirms whether the "oauth_token" or
// 	 * "access_token" request parameter exists or not.
// 	 * 
// 	 * @param request The request object.
// 	 * @return If either parameter exists, this result is true.
// 	 */
// 	@Override
// 	public boolean match(Request request) {
// 		String oauthToken = request.getParameter("oauth_token");
// 		String accessToken = request.getParameter("access_token");
// 		return StringUtils.isNotEmpty(accessToken)
// 			|| StringUtils.isNotEmpty(oauthToken);
// 	}
// 
// 	/**
// 	 * Fetch an access token from a request parameter and return it.
// 	 * This method must be called when a result of the match() method is true
// 	 * only.
// 	 * 
// 	 * @param request The request object.
// 	 * @return the fetched access token.
// 	 */
// 	@Override
// 	public FetchResult fetch(Request request) {
// 		Map<String, String> params = new HashMap<String, String>();
// 		Map<String, String> parameterMap = request.getParameterMap();
// 		params.putAll(parameterMap);
// 		String token = params.get("access_token");
// 		params.remove("access_token");
// 		if (StringUtils.isNotEmpty(params.get("oauth_token"))) {
// 			token = params.get("oauth_token");
// 			params.remove("oauth_token");
// 		}
// 		return new FetchResult(token, params);
// 	}
// 
// }
// 
// Path: src/main/java/jp/eisbahn/oauth2/server/models/Request.java
// public interface Request {
// 
// 	/**
// 	 * Retrieve the parameter value specified by the parameter name
// 	 * from the request.
// 	 * @param name The parameter name.
// 	 * @return The value against the name.
// 	 */
// 	public String getParameter(String name);
// 
// 	/**
// 	 * Retrieve all parameter names and values from the request as a Map instance.
// 	 * @return  The map instance which has all parameter names and values.
// 	 */
// 	public Map<String, String> getParameterMap();
// 	
// 	/**
// 	 * Retrieve the request header value from the request.
// 	 * @param name The header's name.
// 	 * @return The value against the name.
// 	 */
// 	public String getHeader(String name);
// 
// }


import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import jp.eisbahn.oauth2.server.fetcher.accesstoken.AccessTokenFetcher.FetchResult;
import jp.eisbahn.oauth2.server.fetcher.accesstoken.impl.RequestParameter;
import jp.eisbahn.oauth2.server.models.Request;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.collections.MapUtils;
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */

package jp.eisbahn.oauth2.server.fetcher.accesstoken.impl;





public class RequestParameterTest {

	private RequestParameter target;

	@Before
	public void setUp() throws Exception {
		target = new RequestParameter();
	}

	@After
	public void tearDown() throws Exception {
		target = null;
	}

	@Test
	public void testMatch() throws Exception {
// Path: src/main/java/jp/eisbahn/oauth2/server/fetcher/accesstoken/AccessTokenFetcher.java
// public static class FetchResult {
// 
// 	private String token;
// 	private Map<String, String> params;
// 
// 	/**
// 	 * This constructor initializes like both parameters become a null value.
// 	 */
// 	public FetchResult() {
// 		this(null, null);
// 	}
// 
// 	/**
// 	 * This constructor initializes with the specified argument values.
// 	 * @param token The access token string.
// 	 * @param params Other parameters.
// 	 */
// 	public FetchResult(String token, Map<String, String> params) {
// 		super();
// 		this.token = token;
// 		this.params = params;
// 	}
// 
// 	/**
// 	 * Set the access token.
// 	 * @param token The token string.
// 	 */
// 	public void setToken(String token) {
// 		this.token = token;
// 	}
// 
// 	/**
// 	 * Retrieve the access token.
// 	 * @return The token string.
// 	 */
// 	public String getToken() {
// 		return token;
// 	}
// 
// 	/**
// 	 * Set other parameters.
// 	 * @param params The other parameter map object.
// 	 */
// 	public void setParams(Map<String, String> params) {
// 		this.params = params;
// 	}
// 
// 	/**
// 	 * Retrieve the other parameters.
// 	 * @return The other parameter map object.
// 	 */
// 	public Map<String, String> getParams() {
// 		return params;
// 	}
// 
// }
// 
// Path: src/main/java/jp/eisbahn/oauth2/server/fetcher/accesstoken/impl/RequestParameter.java
// public class RequestParameter implements AccessTokenFetcher {
// 
// 	/**
// 	 * Return whether an access token is included in the request parameter's
// 	 * values. Actually, this method confirms whether the "oauth_token" or
// 	 * "access_token" request parameter exists or not.
// 	 * 
// 	 * @param request The request object.
// 	 * @return If either parameter exists, this result is true.
// 	 */
// 	@Override
// 	public boolean match(Request request) {
// 		String oauthToken = request.getParameter("oauth_token");
// 		String accessToken = request.getParameter("access_token");
// 		return StringUtils.isNotEmpty(accessToken)
// 			|| StringUtils.isNotEmpty(oauthToken);
// 	}
// 
// 	/**
// 	 * Fetch an access token from a request parameter and return it.
// 	 * This method must be called when a result of the match() method is true
// 	 * only.
// 	 * 
// 	 * @param request The request object.
// 	 * @return the fetched access token.
// 	 */
// 	@Override
// 	public FetchResult fetch(Request request) {
// 		Map<String, String> params = new HashMap<String, String>();
// 		Map<String, String> parameterMap = request.getParameterMap();
// 		params.putAll(parameterMap);
// 		String token = params.get("access_token");
// 		params.remove("access_token");
// 		if (StringUtils.isNotEmpty(params.get("oauth_token"))) {
// 			token = params.get("oauth_token");
// 			params.remove("oauth_token");
// 		}
// 		return new FetchResult(token, params);
// 	}
// 
// }
// 
// Path: src/main/java/jp/eisbahn/oauth2/server/models/Request.java
// public interface Request {
// 
// 	/**
// 	 * Retrieve the parameter value specified by the parameter name
// 	 * from the request.
// 	 * @param name The parameter name.
// 	 * @return The value against the name.
// 	 */
// 	public String getParameter(String name);
// 
// 	/**
// 	 * Retrieve all parameter names and values from the request as a Map instance.
// 	 * @return  The map instance which has all parameter names and values.
// 	 */
// 	public Map<String, String> getParameterMap();
// 	
// 	/**
// 	 * Retrieve the request header value from the request.
// 	 * @param name The header's name.
// 	 * @return The value against the name.
// 	 */
// 	public String getHeader(String name);
// 
// }


// Path: src/test/java/jp/eisbahn/oauth2/server/fetcher/accesstoken/impl/RequestParameterTest.java
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import jp.eisbahn.oauth2.server.fetcher.accesstoken.AccessTokenFetcher.FetchResult;
import jp.eisbahn.oauth2.server.fetcher.accesstoken.impl.RequestParameter;
import jp.eisbahn.oauth2.server.models.Request;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.collections.MapUtils;

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */

package jp.eisbahn.oauth2.server.fetcher.accesstoken.impl;





public class RequestParameterTest {

	private RequestParameter target;

	@Before
	public void setUp() throws Exception {
		target = new RequestParameter();
	}

	@After
	public void tearDown() throws Exception {
		target = null;
	}

	@Test
	public void testMatch() throws Exception {
		Request req;