// Path: src/main/java/org/force66/beantester/utils/BeanTesterException.java
// public class BeanTesterException extends ContextedRuntimeException {
// 
// 	private static final long serialVersionUID = 8531575225162635884L;
// 
// 	public BeanTesterException() {}
// 
// 	public BeanTesterException(String message) {
// 		super(message);
// 	}
// 
// 	public BeanTesterException(Throwable cause) {
// 		super(cause);
// 	}
// 
// 	public BeanTesterException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// }
// 
// Path: src/main/java/org/force66/beantester/utils/InstantiationUtils.java
// public class InstantiationUtils {
// 	
// 	public static Object safeNewInstance(Class<?> klass) {
// 		return safeNewInstance(klass, null);
// 	}
// 	
// 	public static Object safeNewInstance(ValueGeneratorFactory factory, Class<?> klass) {
// 		Validate.notNull(klass, "Null class not allowed.");
// 		Constructor<?> ctor = findPublicConstructor(klass);
// 		if (ctor == null) {
// 			throw new BeanTesterException("No public constructor found -- value generation isn't possible")
// 				.addContextValue("class", klass.getName());
// 		}
// 		if (ctor.getParameterTypes().length == 0) {
// 			return safeNewInstance(klass, null);
// 		}
// 		
// 		ValueGenerator<?> generator = null;
// 		List<Object> constructorArgs = new ArrayList<Object>();
// 		for (Class<?> argType: ctor.getParameterTypes()) {
// 			generator = factory.forClass(argType);
// 			if (generator == null) {
// 				throw new BeanTesterException("Value can't be generated for constructor argument")
// 					.addContextValue("class", klass.getName())
// 					.addContextValue("constructor", ctor)
// 					.addContextValue("argument type", argType.getName());
// 			}
// 			constructorArgs.add(generator.makeValues()[0]);
// 		}
// 		
// 		return safeNewInstance(klass, constructorArgs.toArray());
// 	}
// 	
// 	public static Constructor<?> findPublicConstructor(Class<?> klass) {
// 		Validate.notNull(klass, "Null class not allowed.");
// 		Constructor<?> nullConstructor = ConstructorUtils.getAccessibleConstructor(klass, new Class<?>[0]);
// 		if (nullConstructor != null) {
// 			return nullConstructor;
// 		}
// 		
// 		Constructor<?>[] constructorArray = klass.getConstructors();
// 		for (Constructor<?> constructor: constructorArray) {
// 			if (Modifier.isPublic(constructor.getModifiers())) {
// 				return constructor;
// 			}
// 		}
// 		
// 		return null;
// 	}
// 	
// 	/**
// 	 * newInstance() execution properly wrapped with exception handling.
// 	 * @param klass
// 	 * @return
// 	 */
// 	public static Object safeNewInstance(Class<?> klass, Object[] constructorArgs) {
// 		Validate.notNull(klass, "Null class not allowed.");
// 		try {
// 			return ConstructorUtils.invokeConstructor(klass, constructorArgs);
// 		} catch (Exception e) {
// 			throw new BeanTesterException("Failed to instantiate bean using newInstance()", e)
// 				.addContextValue("className", klass.getName());
// 		} 
// 	}
// 	
// 	public static XMLGregorianCalendar newXMLGregorianCalendar() {
// 		try {
// 			return DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
// 		} catch (DatatypeConfigurationException e) {
// 			throw new BeanTesterException("This shouldn't happen", e);
// 		}
// 	}
// 
// }


import org.force66.beantester.utils.InstantiationUtils;
import org.force66.beantester.utils.BeanTesterException;
/*
 * This software is licensed under the Apache License, Version 2.0
 * (the "License") agreement; 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 org.force66.beantester.tests;


/**
 * HashcodeEquals test.
 * @author D. Greenfield
 *
 */
public class HashcodeEqualsTest extends BaseBeanTest {

	@Override
	public boolean testBeanClass(Class<?> klass, Object[] constructorArgs) {
		Object instance1 = InstantiationUtils.safeNewInstance(klass, constructorArgs);
// Path: src/main/java/org/force66/beantester/utils/BeanTesterException.java
// public class BeanTesterException extends ContextedRuntimeException {
// 
// 	private static final long serialVersionUID = 8531575225162635884L;
// 
// 	public BeanTesterException() {}
// 
// 	public BeanTesterException(String message) {
// 		super(message);
// 	}
// 
// 	public BeanTesterException(Throwable cause) {
// 		super(cause);
// 	}
// 
// 	public BeanTesterException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// }
// 
// Path: src/main/java/org/force66/beantester/utils/InstantiationUtils.java
// public class InstantiationUtils {
// 	
// 	public static Object safeNewInstance(Class<?> klass) {
// 		return safeNewInstance(klass, null);
// 	}
// 	
// 	public static Object safeNewInstance(ValueGeneratorFactory factory, Class<?> klass) {
// 		Validate.notNull(klass, "Null class not allowed.");
// 		Constructor<?> ctor = findPublicConstructor(klass);
// 		if (ctor == null) {
// 			throw new BeanTesterException("No public constructor found -- value generation isn't possible")
// 				.addContextValue("class", klass.getName());
// 		}
// 		if (ctor.getParameterTypes().length == 0) {
// 			return safeNewInstance(klass, null);
// 		}
// 		
// 		ValueGenerator<?> generator = null;
// 		List<Object> constructorArgs = new ArrayList<Object>();
// 		for (Class<?> argType: ctor.getParameterTypes()) {
// 			generator = factory.forClass(argType);
// 			if (generator == null) {
// 				throw new BeanTesterException("Value can't be generated for constructor argument")
// 					.addContextValue("class", klass.getName())
// 					.addContextValue("constructor", ctor)
// 					.addContextValue("argument type", argType.getName());
// 			}
// 			constructorArgs.add(generator.makeValues()[0]);
// 		}
// 		
// 		return safeNewInstance(klass, constructorArgs.toArray());
// 	}
// 	
// 	public static Constructor<?> findPublicConstructor(Class<?> klass) {
// 		Validate.notNull(klass, "Null class not allowed.");
// 		Constructor<?> nullConstructor = ConstructorUtils.getAccessibleConstructor(klass, new Class<?>[0]);
// 		if (nullConstructor != null) {
// 			return nullConstructor;
// 		}
// 		
// 		Constructor<?>[] constructorArray = klass.getConstructors();
// 		for (Constructor<?> constructor: constructorArray) {
// 			if (Modifier.isPublic(constructor.getModifiers())) {
// 				return constructor;
// 			}
// 		}
// 		
// 		return null;
// 	}
// 	
// 	/**
// 	 * newInstance() execution properly wrapped with exception handling.
// 	 * @param klass
// 	 * @return
// 	 */
// 	public static Object safeNewInstance(Class<?> klass, Object[] constructorArgs) {
// 		Validate.notNull(klass, "Null class not allowed.");
// 		try {
// 			return ConstructorUtils.invokeConstructor(klass, constructorArgs);
// 		} catch (Exception e) {
// 			throw new BeanTesterException("Failed to instantiate bean using newInstance()", e)
// 				.addContextValue("className", klass.getName());
// 		} 
// 	}
// 	
// 	public static XMLGregorianCalendar newXMLGregorianCalendar() {
// 		try {
// 			return DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
// 		} catch (DatatypeConfigurationException e) {
// 			throw new BeanTesterException("This shouldn't happen", e);
// 		}
// 	}
// 
// }


// Path: src/main/java/org/force66/beantester/tests/HashcodeEqualsTest.java
import org.force66.beantester.utils.InstantiationUtils;
import org.force66.beantester.utils.BeanTesterException;

/*
 * This software is licensed under the Apache License, Version 2.0
 * (the "License") agreement; 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 org.force66.beantester.tests;


/**
 * HashcodeEquals test.
 * @author D. Greenfield
 *
 */
public class HashcodeEqualsTest extends BaseBeanTest {

	@Override
	public boolean testBeanClass(Class<?> klass, Object[] constructorArgs) {
		Object instance1 = InstantiationUtils.safeNewInstance(klass, constructorArgs);
		Object instance2 = InstantiationUtils.safeNewInstance(klass, constructorArgs);