CustomURIResolver implements URIResolver { static String getPart(final String key, final String href, final String defaultValue) { return getQuotedPart(key, href, "'") .orElseGet(() -> getQuotedPart(key, href, "\"") .orElseGet(() -> getQuotedPart(key, href, "") .orElse(defaultValue))); } @Inject  CustomURIResolver(final XsltStore xsltStore); Source resolve(final String href, final String base);  }
@Test void testGetPart() { final DocRef docRef = new DocRef(PipelineDoc.DOCUMENT_TYPE, "test-uuid", "test-name"); String docRefString = docRef.toString(); docRefString = docRefString.replaceAll("\"", "'"); String value = CustomURIResolver.getPart("type", docRefString, null); assertThat(value).isEqualTo(PipelineDoc.DOCUMENT_TYPE); value = CustomURIResolver.getPart("uuid", docRefString, null); assertThat(value).isEqualTo("test-uuid"); value = CustomURIResolver.getPart("name", docRefString, null); assertThat(value).isEqualTo("test-name"); docRefString = docRefString.replaceAll("'", "\""); value = CustomURIResolver.getPart("type", docRefString, null); assertThat(value).isEqualTo(PipelineDoc.DOCUMENT_TYPE); value = CustomURIResolver.getPart("uuid", docRefString, null); assertThat(value).isEqualTo("test-uuid"); value = CustomURIResolver.getPart("name", docRefString, null); assertThat(value).isEqualTo("test-name"); docRefString = "type=Pipeline, uuid=test-uuid, name=test-name"; value = CustomURIResolver.getPart("type", docRefString, null); assertThat(value).isEqualTo(PipelineDoc.DOCUMENT_TYPE); value = CustomURIResolver.getPart("uuid", docRefString, null); assertThat(value).isEqualTo("test-uuid"); value = CustomURIResolver.getPart("name", docRefString, null); assertThat(value).isEqualTo("test-name"); }