@Test
	public void testAddToView() throws Exception {

		// make sure we have projects to use as the project view...
		ProjectTestUtils.getProject(DIRECTORY_NAME, PROJECT_VIEW1).close();
		ProjectTestUtils.getProject(DIRECTORY_NAME, PROJECT_VIEW2).close();

		// get project (create it if it doesn't exist...)
		Project project = ProjectTestUtils.getProject(DIRECTORY_NAME, PROJECT_NAME1);

		try {
			URL view = GhidraURL.makeURL(DIRECTORY_NAME, PROJECT_VIEW1);
			project.addProjectView(view, true);

			// add another view that will be removed to test the remove
			project.addProjectView(GhidraURL.makeURL(DIRECTORY_NAME, PROJECT_VIEW2), true);

			// validate the view was added to project
			ProjectLocator[] projViews = project.getProjectViews();
			for (ProjectLocator projView : projViews) {
				Msg.debug(this, "** added view: " + projView);
			}

			// remove the view...
			project.removeProjectView(view);
			Msg.debug(this, "** removed view: " + view);

			projViews = project.getProjectViews();
			for (ProjectLocator projView : projViews) {
				if (view.equals(projView)) {
					Assert.fail("Found project view (" + view + ") that should have been removed!");
				}
			}
		}
		finally {
			project.close();
		}
	}
Test class for adding and a view to a project, and removing
the view from the project.
Ghidra/Features/Base/src/test.slow/java/ghidra/framework/project/AddViewToProjectTest.java