gt: 		GeometricalComponent componentCopy = new GeometricalComponent();
context: /*******************************************************************************
   * Copyright (c) 2014 UT-Battelle, LLC.
   * All rights reserved. This program and the accompanying materials
   * are made available under the terms of the Eclipse Public License v1.0
   * which accompanies this distribution, and is available at
   * http://www.eclipse.org/legal/epl-v10.html
   *
   * Contributors:
   *   Initial API and implementation and/or initial documentation - Jay Jay Billings,
   *   Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson,
   *   Claire Saunders, Matthew Wang, Anna Wojtowicz
   *******************************************************************************/
  package org.eclipse.ice.reactor.plant.test;
  
  import static org.junit.Assert.assertEquals;
  import static org.junit.Assert.assertFalse;
  import static org.junit.Assert.assertNotNull;
  import static org.junit.Assert.assertTrue;
  import static org.junit.Assert.fail;
  
  import java.io.ByteArrayInputStream;
  import java.io.ByteArrayOutputStream;
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.concurrent.atomic.AtomicBoolean;
  
  import javax.xml.bind.JAXBException;
  
  import org.eclipse.ice.datastructures.ICEObject.Component;
  import org.eclipse.ice.datastructures.ICEObject.ICEJAXBHandler;
  import org.eclipse.ice.datastructures.ICEObject.IUpdateable;
  import org.eclipse.ice.datastructures.ICEObject.IUpdateableListener;
  import org.eclipse.ice.datastructures.componentVisitor.IReactorComponent;
  import org.eclipse.ice.datastructures.componentVisitor.SelectiveComponentVisitor;
  import org.eclipse.ice.reactor.plant.GeometricalComponent;
  import org.eclipse.ice.reactor.plant.PlantComponent;
  import org.eclipse.ice.reactor.plant.SelectivePlantComponentVisitor;
  import org.junit.Test;
  
  /**
   * 
   * @author Anna Wojtowicz
   */
  public class GeometricalComponentTester {
  	/**
  	 * <p>
  	 * Boolean flag to mark if the component was successfully visited.
  	 * </p>
  	 * 
  	 */
  	private boolean wasVisited = false;
  
  	/**
  	 * <p>
  	 * Checks the construction of the component.
  	 * </p>
  	 * 
  	 */
  	@Test
  	public void checkConstruction() {
  
  		/* ---- Check nullary constructor ---- */
  
  		// Create a new component.
  		GeometricalComponent component = new GeometricalComponent();
  
  		double[] position = new double[3], orientation = new double[3];
  
  		// Check the default values.
  		assertEquals("Geometrical Component 1", component.getName());
  		assertEquals("A geometrical plant component for reactors",
  				component.getDescription());
  		assertEquals(1, component.getId());
  		assertTrue(Arrays.equals(position, component.getPosition()));
  		assertTrue(Arrays.equals(orientation, component.getOrientation()));
  		assertTrue(0.0 == component.getRotation());
  		assertTrue(1 == component.getNumElements());
  
  		/* ---- Check parameterized constructor ---- */
  
  		// Create a new component with valid parameters.
  		for (int i = 0; i < 3; i++) {
  			position[i] = 5 * i + 3.4930;
  			orientation[i] = 7 * i + 2.1893;
  		}
  		double rotation = 270, numElements = 1;
  		component = new GeometricalComponent(position, orientation, rotation);
  
  		// Check the values.
  		assertEquals("Geometrical Component 1", component.getName());
  		assertEquals("A geometrical plant component for reactors",
  				component.getDescription());
  		assertEquals(1, component.getId());
  		assertTrue(Arrays.equals(position, component.getPosition()));
  		assertTrue(Arrays.equals(orientation, component.getOrientation()));
  		assertTrue(rotation == component.getRotation());
  		assertTrue(numElements == component.getNumElements());
  
  		// We don't need to check with invalid parameters as the setters used
  		// in construction will throw InvalidParameterExceptions.
  
  		return;
  	}
  
  	/**
  	 * <p>
  	 * Checks the getting and setting of the component's attributes.
  	 * </p>
  	 * 
  	 */
  	@Test
  	public void checkProperties() {
  
  		// Create a new component.
  		GeometricalComponent component = new GeometricalComponent();
  
  		// Set valid position, orientation and rotation values.
  		double[] position = new double[3], orientation = new double[3];
  		for (int i = 0; i < 3; i++) {
  			position[i] = 5 * i + 3.4930;
  			orientation[i] = 7 * i + 2.1893;
  		}
  		double rotation = 172;
  		int numElements = 15;
  		component.setPosition(position);
  		component.setOrientation(orientation);
  		component.setRotation(rotation);
  		component.setNumElements(numElements);
  
  		// Check the values were sucessfully set.
  		assertTrue(Arrays.equals(position, component.getPosition()));
  		assertTrue(Arrays.equals(orientation, component.getOrientation()));
  		assertTrue(rotation == component.getRotation());
  		assertTrue(numElements == component.getNumElements());
  
  		// We don't need to check with invalid parameters as the setters will
  		// throw InvalidParameterExceptions.
  
  	}
  
  	/**
  	 * <p>
  	 * Checks the hashCode and equality methods of the component.
  	 * </p>
  	 * 
  	 */
  	@Test
  	public void checkEquality() {
  
  		// Construct a component to test against.
  		GeometricalComponent component = new GeometricalComponent();
  		component.setName("Tyrion Lannister");
  		component.setDescription("Shrewd, educated, and calculating");
  		component.setId(7);
  		double[] position = new double[3], orientation = new double[3];
  		for (int i = 0; i < 3; i++) {
  			position[i] = 17.44 * i + 9.881;
  			orientation[i] = 2.2 * i + 2.1893;
  		}
  		double rotation = 172;
  		int numElements = 8;
  		component.setPosition(position);
  		component.setOrientation(orientation);
  		component.setRotation(rotation);
  		component.setNumElements(numElements);
  
  		// Construct a component equal to the first.
  		GeometricalComponent equalComponent = new GeometricalComponent();
  		equalComponent.setName("Tyrion Lannister");
  		equalComponent.setDescription("Shrewd, educated, and calculating");
  		equalComponent.setId(7);
  		equalComponent.setPosition(position);
  		equalComponent.setOrientation(orientation);
  		equalComponent.setRotation(rotation);
  		equalComponent.setNumElements(numElements);
  
  		// Construct a component not equal to the first.
  		GeometricalComponent unequalComponent = new GeometricalComponent();
  		unequalComponent.setName("Jaime Lannister");
  		unequalComponent
  				.setDescription("A born warrior, but confused about the boundaries of familial relations");
  		unequalComponent.setId(40);
  		for (int i = 0; i < 3; i++) {
  			position[i] = 47.61 * i + 10.4;
  			orientation[i] = 78.1 * i + 66.11;
  		}
  		rotation = 78.4444;
  		numElements = 10;
  		unequalComponent.setPosition(position);
  		unequalComponent.setOrientation(orientation);
  		unequalComponent.setRotation(rotation);
  		unequalComponent.setNumElements(numElements);
  
  		// Check that component and unequalComponet are not the same.
  		assertFalse(component.equals(unequalComponent));
  		assertFalse(unequalComponent.equals(component));
  
  		// Check that equality also fails with illegal values
  		assertFalse(component == null);
  		assertFalse(component.equals(11));
  		assertFalse("House Lannister".equals(component));
  
  		// Check is equals() is reflexive and symmetric.
  		assertTrue(component.equals(component));
  		assertTrue(component.equals(equalComponent)
  				&& equalComponent.equals(component));
  
  		// Construct a component equal to the first, for testing transitivity.
  		GeometricalComponent transComponent = new GeometricalComponent();
  		transComponent.setName("Tyrion Lannister");
  		transComponent.setDescription("Shrewd, educated, and calculating");
  		transComponent.setId(7);
  		for (int i = 0; i < 3; i++) {
  			position[i] = 17.44 * i + 9.881;
  			orientation[i] = 2.2 * i + 2.1893;
  		}
  		rotation = 172;
  		numElements = 8;
  		transComponent.setPosition(position);
  		transComponent.setOrientation(orientation);
  		transComponent.setRotation(rotation);
  		transComponent.setNumElements(numElements);
  
  		// Check equals() is transitive.
  		if (component.equals(transComponent)
  				&& transComponent.equals(equalComponent)) {
  			assertTrue(component.equals(equalComponent));
  		} else {
  			fail();
  		}
  		// Check the hashCode values.
  		assertEquals(component.hashCode(), component.hashCode());
  		assertEquals(component.hashCode(), equalComponent.hashCode());
  		assertFalse(component.hashCode() == unequalComponent.hashCode());
  
  		return;
  	}
  
  	/**
  	 * <p>
  	 * Checks the copy and clone methods of the component.
  	 * </p>
  	 * 
  	 */
  	@Test
  	public void checkCopying() {
  
  		// Construct a base component to copy from.
  		GeometricalComponent component = new GeometricalComponent();
  		component.setName("Cersei Lannister");
  		component.setDescription("The Queen Regent of the Seven Kingdoms");
  		component.setId(39);
  		double[] position = new double[3], orientation = new double[3];
  		for (int i = 0; i < 3; i++) {
  			position[i] = Math.random() * (i + 100);
  			orientation[i] = Math.random() * (i + 100);
  		}
  		double rotation = 172;
  		int numElements = 9;
  		component.setPosition(position);
  		component.setOrientation(orientation);
  		component.setRotation(rotation);
  		component.setNumElements(numElements);
  
  		/* ---- Check copying ---- */
  
  		// Construct an empty component to copy to.
  