// Path: src/main/java/com/bretpatterson/schemagen/graphql/IGraphQLObjectMapper.java
// public interface IGraphQLObjectMapper {
// 
// 	/**
// 	 * Get the object responsible for naming GraphQL types.
// 	 * @return
// 	 */
// 	ITypeNamingStrategy getTypeNamingStrategy();
// 
// 	/**
// 	 * Get an input definition for the specified type.
// 	 * @param type
// 	 */
// 	GraphQLInputType getInputType(Type type);
// 
// 	/**
// 	 * Get an output definition for the specified type.
// 	 * @param type
// 	 */
// 	GraphQLOutputType getOutputType(Type type);
// 
// 	/**
// 	 * Get the Input Type cache. This is useful for custom type mappers who
// 	 * might need to add TypeReference's to the cache when they need to process
// 	 * an object that contains a two way dependency between itself and another object.
// 	 */
// 	IGraphQLTypeCache<GraphQLInputType> getInputTypeCache();
// 
// 	/**
// 	 * Get the Input Type cache. This is useful for custom type mappers who
// 	 * might need to add TypeReference's to the cache when they need to process
// 	 * an object that contains a two way dependency between itself and another object.
// 	 */
// 	IGraphQLTypeCache<GraphQLOutputType> getOutputTypeCache();
// 
// 	/**
// 	 * Returns the object responsible for object type conversion.
// 	 * @return
// 	 */
// 	ITypeFactory getTypeFactory();
// 
// 	/**
// 	 * Get the raw type of this object for generic types
// 	 * @param type
// 	 * @return
// 	 */
// 	Class<?> getClassFromType(Type type);
// 
// 	/**
// 	 * Returns all input types created.
// 	 * @return
// 	 */
// 	Set<GraphQLType> getInputTypes();
// 
// 	/**
// 	 * Get the datafetcher factory
// 	 * @return
// 	 */
// 	IDataFetcherFactory getDataFetcherFactory() ;
// 
// 	/**
// 	 *
// 	 * @param dataFetcherFactory
// 	 */
// 	void setDataFetcherFactory(IDataFetcherFactory dataFetcherFactory);
// 
// 	/**
// 	 * Get the default datafetcher for methods
// 	 * @return
// 	 */
// 	Class<? extends IDataFetcher> getDefaultMethodDataFetcher();
// 
// 	/**
// 	 * Set the default data fetcher used for methods
// 	 * @param defaultMethodDataFetcher
// 	 */
// 	void setDefaultMethodDataFetcher(Class<? extends IDataFetcher> defaultMethodDataFetcher);
// 
// 	Collection<GraphQLFieldDefinition> getGraphQLFieldDefinitions(Optional<Object> targetObject, Type type, Class<?> classItem, Optional<List<Field>> fields, Optional<List<Method>> methods);
// }
// 
// Path: src/main/java/com/bretpatterson/schemagen/graphql/ITypeNamingStrategy.java
// public interface ITypeNamingStrategy {
// 
// 	/**
// 	 * Get the GraphQL type name for the specified type
// 	 * @param graphQLObjectMapper
// 	 * @param type
// 	 * @return
// 	 */
// 	String getTypeName(IGraphQLObjectMapper graphQLObjectMapper, Type type);
// 
// 	/**
// 	 * String to append to GraphQL InputType's
// 	 * @return
// 	 */
// 	String getInputTypePostfix();
// 
// 	/**
// 	 * Delimiter used for separating sections of a type name
// 	 * @return
// 	 */
// 	String getDelimiter();
// }


import com.bretpatterson.schemagen.graphql.IGraphQLObjectMapper;
import com.bretpatterson.schemagen.graphql.ITypeNamingStrategy;
import com.bretpatterson.schemagen.graphql.relay.RelayConnection;
import com.google.common.reflect.TypeToken;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
package com.bretpatterson.schemagen.graphql.impl;



/**
 * Created by bpatterson on 2/10/16.
 */
public class SimpleTypeNamingStrategyTest {
	IGraphQLObjectMapper graphQLObjectMapper = mock(IGraphQLObjectMapper.class);

	private class Connection<T> {
		@SuppressWarnings("unused")
		T field;
	}

	@SuppressWarnings({ "unchecked", "serial", "rawtypes" })
	@Test
	public void TestSimpleType() {
		ITypeNamingStrategy strategy = new SimpleTypeNamingStrategy();


		given(graphQLObjectMapper.getClassFromType(eq(String.class))).willReturn((Class) String.class);

		assertEquals("String", strategy.getTypeName(graphQLObjectMapper, String.class));

		given(graphQLObjectMapper.getClassFromType(eq(new TypeToken<RelayConnection<String>>(){}.getType()))).willReturn((Class) RelayConnection.class);
		assertEquals("RelayConnection_String", strategy.getTypeName(graphQLObjectMapper, new TypeToken<RelayConnection<String>>(){}.getType()));

		given(graphQLObjectMapper.getClassFromType(eq(new TypeToken<Connection<String>>(){}.getType()))).willReturn((Class) Connection.class);
		assertEquals("Connection_String", strategy.getTypeName(graphQLObjectMapper, new TypeToken<Connection<String>>(){}.getType()));
	}

	@SuppressWarnings({ "unchecked", "serial", "rawtypes" })
// Path: src/main/java/com/bretpatterson/schemagen/graphql/IGraphQLObjectMapper.java
// public interface IGraphQLObjectMapper {
// 
// 	/**
// 	 * Get the object responsible for naming GraphQL types.
// 	 * @return
// 	 */
// 	ITypeNamingStrategy getTypeNamingStrategy();
// 
// 	/**
// 	 * Get an input definition for the specified type.
// 	 * @param type
// 	 */
// 	GraphQLInputType getInputType(Type type);
// 
// 	/**
// 	 * Get an output definition for the specified type.
// 	 * @param type
// 	 */
// 	GraphQLOutputType getOutputType(Type type);
// 
// 	/**
// 	 * Get the Input Type cache. This is useful for custom type mappers who
// 	 * might need to add TypeReference's to the cache when they need to process
// 	 * an object that contains a two way dependency between itself and another object.
// 	 */
// 	IGraphQLTypeCache<GraphQLInputType> getInputTypeCache();
// 
// 	/**
// 	 * Get the Input Type cache. This is useful for custom type mappers who
// 	 * might need to add TypeReference's to the cache when they need to process
// 	 * an object that contains a two way dependency between itself and another object.
// 	 */
// 	IGraphQLTypeCache<GraphQLOutputType> getOutputTypeCache();
// 
// 	/**
// 	 * Returns the object responsible for object type conversion.
// 	 * @return
// 	 */
// 	ITypeFactory getTypeFactory();
// 
// 	/**
// 	 * Get the raw type of this object for generic types
// 	 * @param type
// 	 * @return
// 	 */
// 	Class<?> getClassFromType(Type type);
// 
// 	/**
// 	 * Returns all input types created.
// 	 * @return
// 	 */
// 	Set<GraphQLType> getInputTypes();
// 
// 	/**
// 	 * Get the datafetcher factory
// 	 * @return
// 	 */
// 	IDataFetcherFactory getDataFetcherFactory() ;
// 
// 	/**
// 	 *
// 	 * @param dataFetcherFactory
// 	 */
// 	void setDataFetcherFactory(IDataFetcherFactory dataFetcherFactory);
// 
// 	/**
// 	 * Get the default datafetcher for methods
// 	 * @return
// 	 */
// 	Class<? extends IDataFetcher> getDefaultMethodDataFetcher();
// 
// 	/**
// 	 * Set the default data fetcher used for methods
// 	 * @param defaultMethodDataFetcher
// 	 */
// 	void setDefaultMethodDataFetcher(Class<? extends IDataFetcher> defaultMethodDataFetcher);
// 
// 	Collection<GraphQLFieldDefinition> getGraphQLFieldDefinitions(Optional<Object> targetObject, Type type, Class<?> classItem, Optional<List<Field>> fields, Optional<List<Method>> methods);
// }
// 
// Path: src/main/java/com/bretpatterson/schemagen/graphql/ITypeNamingStrategy.java
// public interface ITypeNamingStrategy {
// 
// 	/**
// 	 * Get the GraphQL type name for the specified type
// 	 * @param graphQLObjectMapper
// 	 * @param type
// 	 * @return
// 	 */
// 	String getTypeName(IGraphQLObjectMapper graphQLObjectMapper, Type type);
// 
// 	/**
// 	 * String to append to GraphQL InputType's
// 	 * @return
// 	 */
// 	String getInputTypePostfix();
// 
// 	/**
// 	 * Delimiter used for separating sections of a type name
// 	 * @return
// 	 */
// 	String getDelimiter();
// }


// Path: src/test/java/com/bretpatterson/schemagen/graphql/impl/SimpleTypeNamingStrategyTest.java
import com.bretpatterson.schemagen.graphql.IGraphQLObjectMapper;
import com.bretpatterson.schemagen.graphql.ITypeNamingStrategy;
import com.bretpatterson.schemagen.graphql.relay.RelayConnection;
import com.google.common.reflect.TypeToken;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;

package com.bretpatterson.schemagen.graphql.impl;



/**
 * Created by bpatterson on 2/10/16.
 */
public class SimpleTypeNamingStrategyTest {
	IGraphQLObjectMapper graphQLObjectMapper = mock(IGraphQLObjectMapper.class);

	private class Connection<T> {
		@SuppressWarnings("unused")
		T field;
	}

	@SuppressWarnings({ "unchecked", "serial", "rawtypes" })
	@Test
	public void TestSimpleType() {
		ITypeNamingStrategy strategy = new SimpleTypeNamingStrategy();


		given(graphQLObjectMapper.getClassFromType(eq(String.class))).willReturn((Class) String.class);

		assertEquals("String", strategy.getTypeName(graphQLObjectMapper, String.class));

		given(graphQLObjectMapper.getClassFromType(eq(new TypeToken<RelayConnection<String>>(){}.getType()))).willReturn((Class) RelayConnection.class);
		assertEquals("RelayConnection_String", strategy.getTypeName(graphQLObjectMapper, new TypeToken<RelayConnection<String>>(){}.getType()));

		given(graphQLObjectMapper.getClassFromType(eq(new TypeToken<Connection<String>>(){}.getType()))).willReturn((Class) Connection.class);
		assertEquals("Connection_String", strategy.getTypeName(graphQLObjectMapper, new TypeToken<Connection<String>>(){}.getType()));
	}

	@SuppressWarnings({ "unchecked", "serial", "rawtypes" })
	@Test