### Question:
StudyActivityPresentation { public void commit() { if(isEditing()) { d_activityList.remove(d_oldActivity); } d_activityList.add(d_newActivity); } StudyActivityPresentation(ObservableList<StudyActivity> activityList, SortedSetModel<Drug> drugOptions);  StudyActivityPresentation(ObservableList<StudyActivity> activityList, SortedSetModel<Drug> drugOptions, StudyActivity activity); boolean isEditing(); ValueModel getNameModel(); ObservableList<Note> getNotesModel(); ValueModel getActivityModel(); List<Activity> getActivityOptions(); TreatmentActivityPresentation getTreatmentModel(); OtherActivityPresentation getOtherActivityModel(); ValueHolder<Boolean> getValidModel(); void commit(); SortedSetModel<Drug> getDrugOptions();  }### Answer:
@Test public void testCommit() { ObservableList<StudyActivity> list1 = new ArrayListModel<StudyActivity>(); StudyActivityPresentation pm1 = new StudyActivityPresentation(list1, null); pm1.getNameModel().setValue("Screening"); pm1.getActivityModel().setValue(PredefinedActivity.SCREENING); pm1.commit(); assertEquals(Collections.singletonList(new StudyActivity("Screening", PredefinedActivity.SCREENING)), list1); ObservableList<StudyActivity> list2 = new ArrayListModel<StudyActivity>(); list2.add(d_activity); StudyActivityPresentation pm2 = new StudyActivityPresentation(list2, null, d_activity); pm2.commit(); assertEquals(Collections.singletonList(d_activity), list2); }