[fix] Fixed RocketTest Failure
This commit is contained in:
		
							parent
							
								
									c556cf93a7
								
							
						
					
					
						commit
						02aefc6b6e
					
				@ -315,6 +315,7 @@ public class Rocket extends RocketComponent {
 | 
			
		||||
		// Rocket copy is cloned, so non-trivial members must be cloned as well:
 | 
			
		||||
		copy.stageMap = new HashMap<Integer, AxialStage>();
 | 
			
		||||
		copy.configSet = new FlightConfigurableParameterSet<FlightConfiguration>( this.configSet );
 | 
			
		||||
		copy.selectedConfiguration = copy.configSet.get( this.getSelectedConfiguration().getId());
 | 
			
		||||
		copy.listenerList = new ArrayList<EventListener>();
 | 
			
		||||
		
 | 
			
		||||
		return copy;
 | 
			
		||||
 | 
			
		||||
@ -17,23 +17,21 @@ public class RocketTest extends BaseTestCase {
 | 
			
		||||
	@Test
 | 
			
		||||
	public void testCopyIndependence() {
 | 
			
		||||
		Rocket rkt1 = TestRockets.makeEstesAlphaIII();
 | 
			
		||||
		FlightConfiguration config1 = rkt1.getSelectedConfiguration();
 | 
			
		||||
		FlightConfigurationId fcid1 = config1.getId();
 | 
			
		||||
		FlightConfiguration config1 = new FlightConfiguration(rkt1, null);
 | 
			
		||||
		rkt1.setFlightConfiguration( config1.getId(), config1);
 | 
			
		||||
		rkt1.setSelectedConfiguration( config1.getId());
 | 
			
		||||
		FlightConfiguration config2 = new FlightConfiguration(rkt1, null);
 | 
			
		||||
		rkt1.setFlightConfiguration( config2.getId(), config2);
 | 
			
		||||
		FlightConfiguration config3 = new FlightConfiguration(rkt1, null);
 | 
			
		||||
		rkt1.setFlightConfiguration( config3.getId(), config3);
 | 
			
		||||
		
 | 
			
		||||
		//System.err.println("src: "+ rkt1.toDebugConfigs());
 | 
			
		||||
		// vvvv test target vvvv 
 | 
			
		||||
		Rocket rkt2 = rkt1.copyWithOriginalID();
 | 
			
		||||
		// ^^^^ test target ^^^^
 | 
			
		||||
		//System.err.println("cpy: "+ rkt1.toDebugConfigs());
 | 
			
		||||
		
 | 
			
		||||
		FlightConfiguration config4 = rkt2.getSelectedConfiguration();
 | 
			
		||||
		FlightConfigurationId fcid4 = config4.getId();
 | 
			
		||||
		assertThat("fcids should match: ", fcid1.key, equalTo(fcid4.key));
 | 
			
		||||
		assertThat("Configurations should be different match: "+config1.toDebug()+"=?="+config4.toDebug(), config1.instanceNumber, not( config4.instanceNumber));
 | 
			
		||||
		
 | 
			
		||||
		assertThat("fcids should match: ", config1.getId().key, equalTo(fcid4.key));
 | 
			
		||||
		assertThat("Configurations should be different: "+config1.toDebug()+"=?="+config4.toDebug(), config1.instanceNumber, not( config4.instanceNumber));
 | 
			
		||||
	
 | 
			
		||||
		FlightConfiguration config5 = rkt2.getFlightConfiguration(config2.getId());
 | 
			
		||||
		FlightConfigurationId fcid5 = config5.getId();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user