### Question:
PreferencesViewModel { public void storeInOptions(final STOptions options) { options.setInitialView(initialView.get()); options.setDefaultAutoCalcuation(defaultAutoCalculation.get()); options.setSaveOnExit(saveOnExit.get()); options.setUnitSystem(unitSystem.get()); options.setPreferredSpeedMode(preferredSpeedMode.get()); options.setWeekStartSunday(weekStart.get() == WeekStart.SUNDAY); options.setListViewShowAvgHeartrate(listViewShowAvgHeartrate.get()); options.setListViewShowAscent(listViewShowAscent.get()); options.setListViewShowDescent(listViewShowDescent.get()); options.setListViewShowEnergy(listViewShowEnergy.get()); options.setListViewShowEquipment(listViewShowEquipment.get()); options.setListViewShowComment(listViewShowComment.get()); options.setDisplaySecondChart(evDisplaySecondChart.get()); options.setDisplaySmoothedCharts(evDisplaySmoothedCharts.get()); } PreferencesViewModel(final STOptions options); void storeInOptions(final STOptions options); final ObjectProperty<STOptions.View> initialView; final ObjectProperty<STOptions.AutoCalculation> defaultAutoCalculation; final BooleanProperty saveOnExit; final ObjectProperty<UnitSystem> unitSystem; final ObjectProperty<SpeedMode> preferredSpeedMode; final ObjectProperty<WeekStart> weekStart; final BooleanProperty listViewShowAvgHeartrate; final BooleanProperty listViewShowAscent; final BooleanProperty listViewShowDescent; final BooleanProperty listViewShowEnergy; final BooleanProperty listViewShowEquipment; final BooleanProperty listViewShowComment; final BooleanProperty evDisplaySecondChart; final BooleanProperty evDisplaySmoothedCharts; }### Answer:
@Test public void testStoreInOptions() { PreferencesViewModel viewModel = new PreferencesViewModel(options); viewModel.storeInOptions(options); assertEquals(STOptions.View.List, options.getInitialView()); assertEquals(UnitSystem.ENGLISH, options.getUnitSystem()); assertEquals(SpeedMode.SPEED, options.getPreferredSpeedMode()); assertEquals(STOptions.AutoCalculation.AvgSpeed, options.getDefaultAutoCalcuation()); assertTrue(options.isSaveOnExit()); assertFalse(options.isDisplaySecondChart()); assertFalse(options.isDisplaySmoothedCharts()); assertTrue(options.isWeekStartSunday()); assertTrue(options.isListViewShowAvgHeartrate()); assertFalse(options.isListViewShowAscent()); assertTrue(options.isListViewShowEnergy()); assertFalse(options.isListViewShowEquipment()); assertTrue(options.isListViewShowComment()); assertEquals("/Foo/Bar", options.getPreviousExerciseDirectory()); viewModel.initialView.set(STOptions.View.Calendar); viewModel.unitSystem.set(UnitSystem.METRIC); viewModel.preferredSpeedMode.set(SpeedMode.PACE); viewModel.weekStart.set(PreferencesViewModel.WeekStart.MONDAY); viewModel.defaultAutoCalculation.set(STOptions.AutoCalculation.Duration); viewModel.saveOnExit.set(false); viewModel.storeInOptions(options); assertEquals(STOptions.View.Calendar, options.getInitialView()); assertEquals(UnitSystem.METRIC, options.getUnitSystem()); assertEquals(SpeedMode.PACE, options.getPreferredSpeedMode()); assertEquals(STOptions.AutoCalculation.Duration, options.getDefaultAutoCalcuation()); assertFalse(options.isSaveOnExit()); }