Simulator/test/model/agent/humanAgent/HumanAgentTest.java
/**
	 * Test actions after the agent was removed.
	 */
Test actions after the agent was removed.
Test actions after the agent was removed .
@Test(expected = IllegalStateException.class)
	public void testPostRemoveActions() {
		HumanAgent agent = new HumanAgent(new Position(10, 10), 0.2, 80, Color.RED) {
			@Override
			public boolean wantsToBeDestoryed() {
				return map.getTime() > 10;
			}
			@Override
			public <T> Collection<T> getObservation(Class<T> type) {
				return null;
			}
			@Override
			public void communicate(CommunicationType type, Object communication) {
			}
		};
		Simulator s = new Simulator.Builder<>().setEndingConditions(new BaseEndingConditions(20)).setGui(false).build();
		s.add(agent);
		Thread t = new Thread(s);
		t.start();
		Assert.assertFalse(agent.isDestroyed());
		try {
			t.join();
		} catch (InterruptedException e) {
		}
		Assert.assertTrue(agent.isDestroyed());
		agent.update(50);
	}
@ Test ( expected = IllegalStateException . class ) public void testPostRemoveActions ( ) { HumanAgent agent = new HumanAgent ( new Position ( 10 , 10 ) , 0.2 , 80 , Color . RED ) { @ Override public boolean wantsToBeDestoryed ( ) { return map . getTime ( ) > 10 ; } @ Override public < T > Collection < T > getObservation ( Class < T > type ) { return null ; } @ Override public void communicate ( CommunicationType type , Object communication ) { } } ; Simulator s = new Simulator . Builder < > ( ) . setEndingConditions ( new BaseEndingConditions ( 20 ) ) . setGui ( false ) . build ( ) ; s . add ( agent ) ; Thread t = new Thread ( s ) ; t . start ( ) ; Assert . assertFalse ( agent . isDestroyed ( ) ) ; try { t . join ( ) ; } catch ( InterruptedException e ) { } Assert . assertTrue ( agent . isDestroyed ( ) ) ; agent . update ( 50 ) ; }
Test actions after the agent was removed.
Test actions after the agent was removed .