/******************************************************************************************************************* * ******************************************************************************************************************/ @Test(dependsOnMethods = "must_properly_initialize_resources") public void must_properly_set_value_to_bound_property() throws NotFoundException, IOException { // given final BoundProperty<String> boundProperty = new BoundProperty<>(); // when underTest.bind(PROPERTY_2, boundProperty, callback); // then assertThat(boundProperty.get(), is(ORIGINAL_PROPERTY_2_VALUE)); verifyZeroInteractions(callback); }
/******************************************************************************************************************* * ******************************************************************************************************************/ @Test(dependsOnMethods = "must_properly_initialize_resources") public void must_be_notified_with_updated_ResourceProperties_when_bound_property_updated() throws NotFoundException, IOException { // given final BoundProperty<String> boundProperty = new BoundProperty<>(); underTest.bind(PROPERTY_2, boundProperty, callback); // when boundProperty.set("New title"); // then verify(callback).notify(argThat(resourcePropertiesWith(map().put(PROPERTY_1, ORIGINAL_PROPERTY_1_VALUE) .put(PROPERTY_2, "New title")))); verifyNoMoreInteractions(callback); }
/******************************************************************************************************************* * * This method demonstrates how to pick a directory name by using the proper UI dialog. * ******************************************************************************************************************/ private void onButtonPickDirectoryPressed() { final BoundProperty<Path> selectedFolder = new BoundProperty<>(USER_HOME); presentation.pickDirectory(selectedFolder, notificationWithFeedback() .withCaption("Pick a directory") .withFeedback(feedback().withOnConfirm(() -> presentation.notify("Selected folder: " + selectedFolder.get())) .withOnCancel(() -> presentation.notify("Selection cancelled")))); }
/******************************************************************************************************************* * * This method demonstrates how to pick a file name by using the proper UI dialog. * ******************************************************************************************************************/ private void onButtonPickFilePressed() { final BoundProperty<Path> selectedFile = new BoundProperty<>(USER_HOME); presentation.pickFile(selectedFile, notificationWithFeedback() .withCaption("Pick a file") .withFeedback(feedback().withOnConfirm(() -> presentation.notify("Selected file: " + selectedFile.get())) .withOnCancel(() -> presentation.notify("Selection cancelled")))); }