@Test
	public void testBrowseButton() throws Exception {
		setText(toolNameField, "MyTestTool", false);
		Preferences.setProperty(Preferences.PROJECT_DIRECTORY, null);

		// choose icon from the filesystem

		// put TestIcon.gif in project dir
		String iconName = "core.png"; // an icon that should not go away
		URL url = ResourceManager.getResource("images/" + iconName);

		assertNotNull("Could not find test icon: " + iconName);

		String tempDir = AbstractGTest.getTestDirectoryPath();

		final File destFile = new File(tempDir, iconName);
		destFile.deleteOnExit();

		InputStream in = url.openStream();
		FileUtilities.copyStreamToFile(in, destFile, false, null);
		in.close();

		final JButton browseButton = (JButton) findComponentByName(saveDialog, "BrowseButton");
		pressButton(browseButton, false);

		final GhidraFileChooser chooser = waitForDialogComponent(GhidraFileChooser.class);

		assertNotNull(chooser);
		runSwing(() -> chooser.setSelectedFile(destFile));
		waitForUpdateOnChooser(chooser);

		final JButton openButton = findButtonByText(chooser, "OK");
		pressButton(openButton);
		waitForSwing();

		ToolIconURL selectedIcon = (ToolIconURL) iconList.getSelectedValue();
		assertNotNull(selectedIcon);
		assertTrue(selectedIcon.getIcon().toString().endsWith(destFile.getName().toString()));

		String lastDirPreference =
			Preferences.getProperty(SaveToolConfigDialog.LAST_ICON_DIRECTORY);
		assertEquals(destFile.getParent(), lastDirPreference);

		saveDialog.close();
	}
Tests for saving the tool config.
Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/framework/plugintool/dialog/SaveToolConfigDialogTest.java