DefaultEntitlementCertServiceAdapter extends BaseEntitlementCertServiceAdapter { public String cleanUpPrefix(String contentPrefix) throws IOException { StringBuffer output = new StringBuffer("/"); for (String part : contentPrefix.split("/")) { if (!part.equals("")) { output.append(URLEncoder.encode(part, "UTF-8")); output.append("/"); } } return output.toString().replace("%24", "$"); } @Inject  DefaultEntitlementCertServiceAdapter(PKIUtility pki,
        X509ExtensionUtil extensionUtil,
        X509V3ExtensionUtil v3extensionUtil,
        EntitlementCertificateCurator entCertCurator,
        KeyPairCurator keyPairCurator,
        CertificateSerialCurator serialCurator,
        OwnerCurator ownerCurator,
        EntitlementCurator entCurator, I18n i18n,
        Configuration config,
        ProductCurator productCurator,
        ConsumerTypeCurator consumerTypeCurator,
        EnvironmentCurator environmentCurator); @Override EntitlementCertificate generateEntitlementCert(Entitlement entitlement, Product product); @Override Map<String, EntitlementCertificate> generateEntitlementCerts(Consumer consumer,
        Map<String, PoolQuantity> poolQuantities, Map<String, Entitlement> entitlements,
        Map<String, Product> products, boolean save); X509Certificate createX509Certificate(Consumer consumer, Owner owner, Pool pool,
        Entitlement ent, Product product, Set<Product> products,
        List<org.candlepin.model.dto.Product> productModels, BigInteger serialNumber,
        KeyPair keyPair, boolean useContentPrefix); Set<X509ExtensionWrapper> prepareV1Extensions(Set<Product> products,
        Pool pool, Consumer consumer, Integer quantity, String contentPrefix,
        Map<String, EnvironmentContent> promotedContent); Set<X509ExtensionWrapper> prepareV3Extensions(); Set<X509ByteExtensionWrapper> prepareV3ByteExtensions(Product sku,
        List<org.candlepin.model.dto.Product> productModels, String contentPrefix,
        Map<String, EnvironmentContent> promotedContent); String cleanUpPrefix(String contentPrefix); List<Long> listEntitlementSerialIds(Consumer consumer);  }
@Test public void testCleanUpPrefixNoChange() throws Exception { String[] prefixes = {"/", "/some_prefix/", "/some-prefix/", "/some.prefix/", "/Some1Prefix2/"}; for (String prefix : prefixes) { assertEquals(prefix, certServiceAdapter.cleanUpPrefix(prefix)); } }