@SuppressWarnings("unchecked")
	public static <T> void replaceService(PluginTool tool, Class<? extends T> service,
			T replacement) {

		ServiceManager serviceManager = (ServiceManager) getInstanceField("serviceMgr", tool);

		Map<String, Set<ClassFileInfo>> extensionPointSuffixToInfoMap =
			(Map<String, Set<ClassFileInfo>>) getInstanceField("extensionPointSuffixToInfoMap",
				ClassSearcher.class);
		HashMap<ClassFileInfo, Class<?>> loadedCache =
			(HashMap<ClassFileInfo, Class<?>>) getInstanceField("loadedCache", ClassSearcher.class);
		String suffix = ClassSearcher.getExtensionPointSuffix(service.getSimpleName());

		if (suffix != null) {
			Set<ClassFileInfo> serviceSet = extensionPointSuffixToInfoMap.get(suffix);
			assertNotNull(serviceSet);
			serviceSet.clear();
			ClassFileInfo info = new ClassFileInfo("", replacement.getClass().getName(), suffix);
			serviceSet.add(info);
			loadedCache.put(info, replacement.getClass());
		}

		T instance = tool.getService(service);
		if (instance != null) {
			serviceManager.removeService(service, instance);
		}
		serviceManager.addService(service, replacement);
	}
Replaces the given implementations of the provided service class with the given class.

@param tool the tool whose services to update (optional)
@param service the service to override
@param replacement the new version of the service
@param <T> the service type
Ghidra/Features/Base/src/main/java/ghidra/test/AbstractGhidraHeadlessIntegrationTest.java