### Question:
JaxRsCdiExtension implements Extension { Optional<String> findContextRoot(io.helidon.config.Config config, JaxRsApplication jaxRsApplication) { return config.get(jaxRsApplication.appClassName() + "." + RoutingPath.CONFIG_KEY_PATH) .asString() .or(jaxRsApplication::contextRoot) .map(path -> (path.startsWith("/") ? path : ("/" + path))); }  List<JaxRsApplication> applicationsToRun(); void removeApplications(); void removeResourceClasses(); void addResourceClasses(List<Class<?>> resourceClasses); void addApplications(List<JaxRsApplication> applications); void addApplication(Application application); void addApplication(String contextRoot, Application application); String serviceName(); void addSyntheticApplication(List<Class<?>> resourceClasses);  }### Answer:
@Test void testContextRootOverrideByConfig() { JaxRsApplication app = JaxRsApplication.create(TestApp.class); Optional<String> contextRoot = extension.findContextRoot(EMPTY_CONFIG, app); assertThat(contextRoot, value(is("/wrong"))); Config config = Config .create(ConfigSources.create(Map.of(TestApp.class.getName() + "." + RoutingPath.CONFIG_KEY_PATH, "config"))); contextRoot = extension.findContextRoot(config, app); assertThat(contextRoot, value(is("/config"))); }
@Test void testContextRootNoConfigGoodPath() { JaxRsApplication app = JaxRsApplication.builder() .contextRoot("/myApp") .build(); Optional<String> contextRoot = extension.findContextRoot(EMPTY_CONFIG, app); assertThat(contextRoot, value(is("/myApp"))); }
@Test void testContextRootNone() { JaxRsApplication app = JaxRsApplication.builder() .build(); Optional<String> contextRoot = extension.findContextRoot(EMPTY_CONFIG, app); assertThat(contextRoot, empty()); }
@Test void testContextRootNoConfigNoLeadingSlash() { JaxRsApplication app = JaxRsApplication.builder() .contextRoot("myApp") .build(); Optional<String> contextRoot = extension.findContextRoot(EMPTY_CONFIG, app); assertThat(contextRoot, value(is("/myApp"))); }
@Test void testContextRootNoConfigWithTrailingSlash() { JaxRsApplication app = JaxRsApplication.builder() .contextRoot("/myApp/") .build(); Optional<String> contextRoot = extension.findContextRoot(EMPTY_CONFIG, app); assertThat(contextRoot, value(is("/myApp"))); }