// Path: src/intTest/java/net/swisstech/bitly/test/util/AssertUtil.java
// public class AssertUtil {
// 
// 	/**
// 	 * Assert that the first argument is greater than the second
// 	 * @param first the first value
// 	 * @param second the second value
// 	 */
// 	public static void assertGreater(long first, long second) {
// 		if (first <= second) {
// 			throw new AssertionError(String.format("expected <%d> to be greater than <%d>", first, second));
// 		}
// 	}
// 
// 	/**
// 	 * Assert that the actual value is part of the expected list
// 	 * @param actual the actual value
// 	 * @param expected the range of allowed values
// 	 */
// 	public static void assertIn(Object actual, Object... expected) {
// 		assertIn(actual, Arrays.asList(expected));
// 	}
// 
// 	/**
// 	 * Assert that the actual value is part of the expected list
// 	 * @param actual the actual value
// 	 * @param expected the range of allowed values
// 	 */
// 	public static void assertIn(Object actual, Collection<?> expected) {
// 		for (Object ex : expected) {
// 			if (ex.equals(actual)) {
// 				return;
// 			}
// 		}
// 		throw new AssertionError(String.format("expected <%s> to be in %s", actual, expected));
// 	}
// }
// 
// Path: src/main/java/net/swisstech/bitly/model/Response.java
// public class Response<T> extends ResponsePartial {
// 
// 	/** This flag will be set if there was a deserialization error */
// 	public boolean deserialize_error = false;
// 
// 	/** the actual response data */
// 	public T data;
// }
// 
// Path: src/main/java/net/swisstech/bitly/model/v3/UserReferringDomainsResponse.java
// public class UserReferringDomainsResponse extends MetricsResponse {
// 
// 	/** a list of domains referring traffic to this user's links */
// 	public List<ReferringDomain> user_referring_domains;
// 
// 	/** a domain referring traffic to this user's links */
// 	public static class ReferringDomain extends ToStringSupport {
// 
// 		/** the number of clicks referred from this domain */
// 		public long clicks;
// 
// 		/** the domain referring clicks */
// 		public String domain;
// 
// 		/** the complete URL of the domain referring clicks (null if the domain is "direct") */
// 		public String url;
// 	}
// }
// 
// Path: src/main/java/net/swisstech/bitly/model/v3/UserReferringDomainsResponse.java
// public static class ReferringDomain extends ToStringSupport {
// 
// 	/** the number of clicks referred from this domain */
// 	public long clicks;
// 
// 	/** the domain referring clicks */
// 	public String domain;
// 
// 	/** the complete URL of the domain referring clicks (null if the domain is "direct") */
// 	public String url;
// }


import static org.testng.Assert.*;
import static net.swisstech.bitly.test.util.AssertUtil.*;
import static net.swisstech.bitly.test.util.TestUtil.printAndVerify;
import net.swisstech.bitly.model.Response;
import net.swisstech.bitly.model.v3.UserReferringDomainsResponse;
import net.swisstech.bitly.model.v3.UserReferringDomainsResponse.ReferringDomain;
import org.testng.annotations.Test;
/*
 * Copyright (c) Patrick Huber (gmail: stackmagic)
 *
 * Licensed 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 net.swisstech.bitly.test;



/**
 * <p>
 * Please see the bit.ly documentation for the <a href="http://dev.bitly.com/user_metrics.html#v3_user_referring_domains">/v3/user/referring_domains</a>
 * request.
 * </p>
 * @author Patrick Huber (gmail: stackmagic)
 */
public class UserReferringDomainsIntegrationTest extends AbstractBitlyClientIntegrationTest {

	@Test
	public void callUserReferringDomainsExpanded() {
		Response<UserReferringDomainsResponse> resp = getClient().userReferringDomainsExpanded() //
			.setUnit("hour") //
			.setUnits(-1) //
			.call();

// Path: src/intTest/java/net/swisstech/bitly/test/util/AssertUtil.java
// public class AssertUtil {
// 
// 	/**
// 	 * Assert that the first argument is greater than the second
// 	 * @param first the first value
// 	 * @param second the second value
// 	 */
// 	public static void assertGreater(long first, long second) {
// 		if (first <= second) {
// 			throw new AssertionError(String.format("expected <%d> to be greater than <%d>", first, second));
// 		}
// 	}
// 
// 	/**
// 	 * Assert that the actual value is part of the expected list
// 	 * @param actual the actual value
// 	 * @param expected the range of allowed values
// 	 */
// 	public static void assertIn(Object actual, Object... expected) {
// 		assertIn(actual, Arrays.asList(expected));
// 	}
// 
// 	/**
// 	 * Assert that the actual value is part of the expected list
// 	 * @param actual the actual value
// 	 * @param expected the range of allowed values
// 	 */
// 	public static void assertIn(Object actual, Collection<?> expected) {
// 		for (Object ex : expected) {
// 			if (ex.equals(actual)) {
// 				return;
// 			}
// 		}
// 		throw new AssertionError(String.format("expected <%s> to be in %s", actual, expected));
// 	}
// }
// 
// Path: src/main/java/net/swisstech/bitly/model/Response.java
// public class Response<T> extends ResponsePartial {
// 
// 	/** This flag will be set if there was a deserialization error */
// 	public boolean deserialize_error = false;
// 
// 	/** the actual response data */
// 	public T data;
// }
// 
// Path: src/main/java/net/swisstech/bitly/model/v3/UserReferringDomainsResponse.java
// public class UserReferringDomainsResponse extends MetricsResponse {
// 
// 	/** a list of domains referring traffic to this user's links */
// 	public List<ReferringDomain> user_referring_domains;
// 
// 	/** a domain referring traffic to this user's links */
// 	public static class ReferringDomain extends ToStringSupport {
// 
// 		/** the number of clicks referred from this domain */
// 		public long clicks;
// 
// 		/** the domain referring clicks */
// 		public String domain;
// 
// 		/** the complete URL of the domain referring clicks (null if the domain is "direct") */
// 		public String url;
// 	}
// }
// 
// Path: src/main/java/net/swisstech/bitly/model/v3/UserReferringDomainsResponse.java
// public static class ReferringDomain extends ToStringSupport {
// 
// 	/** the number of clicks referred from this domain */
// 	public long clicks;
// 
// 	/** the domain referring clicks */
// 	public String domain;
// 
// 	/** the complete URL of the domain referring clicks (null if the domain is "direct") */
// 	public String url;
// }


// Path: src/intTest/java/net/swisstech/bitly/test/UserReferringDomainsIntegrationTest.java
import static org.testng.Assert.*;
import static net.swisstech.bitly.test.util.AssertUtil.*;
import static net.swisstech.bitly.test.util.TestUtil.printAndVerify;
import net.swisstech.bitly.model.Response;
import net.swisstech.bitly.model.v3.UserReferringDomainsResponse;
import net.swisstech.bitly.model.v3.UserReferringDomainsResponse.ReferringDomain;
import org.testng.annotations.Test;

/*
 * Copyright (c) Patrick Huber (gmail: stackmagic)
 *
 * Licensed 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 net.swisstech.bitly.test;



/**
 * <p>
 * Please see the bit.ly documentation for the <a href="http://dev.bitly.com/user_metrics.html#v3_user_referring_domains">/v3/user/referring_domains</a>
 * request.
 * </p>
 * @author Patrick Huber (gmail: stackmagic)
 */
public class UserReferringDomainsIntegrationTest extends AbstractBitlyClientIntegrationTest {

	@Test
	public void callUserReferringDomainsExpanded() {
		Response<UserReferringDomainsResponse> resp = getClient().userReferringDomainsExpanded() //
			.setUnit("hour") //
			.setUnits(-1) //
			.call();

		printAndVerify(resp, UserReferringDomainsResponse.class);