Individual { public void setState(State state) { if (this.state != state) { this.state = state; if (individualStateListeners != null) { for (IndividualStateListener listener : individualStateListeners) { listener.inidividualStateChanged(this); } } } } @Inject protected  Individual(); Object getPhenotype(); Objectives getObjectives(); Genotype getGenotype(); void setGenotype(Genotype genotype); void setPhenotype(Object phenotype); void setObjectives(Objectives objectives); boolean isDecoded(); boolean isEvaluated(); void setState(State state); State getState();  }
@Test public void setStateTest() { Individual individual = new Individual(); IndividualStateListener listener = new IndividualStateListener() { @Override public void inidividualStateChanged(Individual individual) { stateChanged = true; } }; individual.setIndividualStatusListeners(Collections.singleton(listener)); individual.setState(State.DECODING); Assert.assertEquals(State.DECODING, individual.getState()); Assert.assertTrue(stateChanged); }