### Question:
StudyOutcomeMeasure extends ObjectWithNotes<T> { public ObservableList<WhenTaken> getWhenTaken() { return d_whenTaken; } StudyOutcomeMeasure(Class<T> cls);  StudyOutcomeMeasure(T obj); private  StudyOutcomeMeasure(T obj, Class<? extends Variable> cls);  StudyOutcomeMeasure(T obj, WhenTaken whenTaken); @Override T getValue(); @Override void setValue(Object newValue); boolean hasPlaceholder(); T getPlaceholder(); @Override StudyOutcomeMeasure<T> clone(); Boolean getIsPrimary(); void setIsPrimary(Boolean isPrimary); ObservableList<WhenTaken> getWhenTaken(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); Class<? extends Variable> getValueClass(); static final String PROPERTY_IS_PRIMARY; static final String PROPERTY_HAS_PLACEHOLDER; }### Answer:
@Test(expected=IllegalArgumentException.class) public void testAddWhenTakenMustBeCommitted() { StudyOutcomeMeasure<Endpoint> som = new StudyOutcomeMeasure<Endpoint>(new Endpoint("Death", new RateVariableType())); WhenTaken wt = new WhenTaken(EntityUtil.createDuration("P08D"), RelativeTo.FROM_EPOCH_START, new Epoch("Epoch", null)); som.getWhenTaken().add(wt); }
@Test(expected=IllegalArgumentException.class) public void testSetWhenTakenMustBeCommitted() { StudyOutcomeMeasure<Endpoint> som = new StudyOutcomeMeasure<Endpoint>(new Endpoint("Death", new RateVariableType())); WhenTaken wt1 = new WhenTaken(EntityUtil.createDuration("P08D"), RelativeTo.FROM_EPOCH_START, new Epoch("Epoch", null)); wt1.commit(); som.getWhenTaken().add(wt1); WhenTaken wt2 = new WhenTaken(EntityUtil.createDuration("P08D"), RelativeTo.FROM_EPOCH_START, new Epoch("Epoch", null)); som.getWhenTaken().set(0, wt2); }