@Test
	public void testStringsContainingExistingStrings() throws Exception {

		Program testProgram = buildProgram("libopencoreplayer.so", false);

		Listing listing = testProgram.getListing();
		AddressSpace space = testProgram.getLanguage().getAddressFactory().getDefaultAddressSpace();

		// Create a string that overlaps where a string normally would be automatically created.
		String[] makeExistingStrs = new String[] { "duration", "VideoMIO" };
		int[] offsets = new int[] { 0xa7198124, 0xa7195fd8 };
		Address[] makeExistingAddrs = new Address[offsets.length];

		CreateDataCmd cmd;
		Data dataHere;
		String stringHere;

		for (int i = 0; i < offsets.length; i++) {
			makeExistingAddrs[i] = addr(space, offsets[i]);
			cmd = new CreateDataCmd(makeExistingAddrs[i], true, new StringDataType());
			cmd.applyTo(testProgram);

			dataHere = listing.getDefinedDataAt(makeExistingAddrs[i]);
			assertNotNull(dataHere);

			stringHere = dataHere.getDefaultValueRepresentation();
			assertEquals("\"" + makeExistingStrs[i] + "\"", stringHere);
		}

		// Offsets where there shouldn't be strings because existing strings were
		// "in the way"
		int[] nonExpectedOffsets = new int[] { 0xa7198120, 0xa7195fd4 };

		// Verify these are not there before running the Strings Analyzer
		for (int nonExpectedOffset : nonExpectedOffsets) {
			dataHere = listing.getDefinedDataAt(addr(space, nonExpectedOffset));
			assertNull(dataHere);
		}

		AutoAnalysisManager manager = AutoAnalysisManager.getAnalysisManager(testProgram);

		// Run strings analyzer
		StringsAnalyzer analyzer = new StringsAnalyzer();
		analyzer.setStringEndAlignment(1);
		analyzer.setCreateStringOverExistingString(false);// Option is unchecked
		analyzer.added(testProgram, null, monitor, manager.getMessageLog());

		for (int nonExpectedOffset : nonExpectedOffsets) {
			dataHere = listing.getDefinedDataAt(addr(space, nonExpectedOffset));
			assertNull(dataHere);
		}

		// Larger string that would have been created if parameter is checked
		String[] largerStrs = new String[] { "drm/duration", "PVFMVideoMIO" };

		// Now run again with parameter enabled and verify strings are there
		analyzer.setCreateStringOverExistingString(true);// Option is checked
		analyzer.added(testProgram, null, monitor, manager.getMessageLog());

		for (int i = 0; i < nonExpectedOffsets.length; i++) {
			dataHere = listing.getDefinedDataAt(addr(space, nonExpectedOffsets[i]));
			assertNotNull(dataHere);
			stringHere = dataHere.getDefaultValueRepresentation();
			assertEquals("\"" + largerStrs[i] + "\"", stringHere);
		}
	}
Verify that unchecking then checking the "Create strings containing existing strings"
 option works as expected.
Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/string/StringsAnalyzerTest.java