@Test public void testRemoveConfigExtension() { final Map<String, String> expectResultsForIds = new LinkedHashMap<>(); expectResultsForIds.put("test.config", "test"); expectResultsForIds.put("test.properties", "test"); expectResultsForIds.put("test.jar", "test.jar"); expectResultsForIds.put("test.zip", "test.zip"); for (Map.Entry<String, String> entry : expectResultsForIds.entrySet()) { assertEquals("expect result for id: " + entry.getKey(), entry.getValue(), DefaultSlingSimulator.removeConfigExtension(entry.getKey())); } }
static String removeConfigExtension(final String id) { for (final String ext : EXTENSIONS) { if (id.endsWith(ext)) { return id.substring(0, id.length() - ext.length()); } } return id; }
DefaultSlingSimulator implements SlingSimulatorBackend, SlingSimulator { static String removeConfigExtension(final String id) { for (final String ext : EXTENSIONS) { if (id.endsWith(ext)) { return id.substring(0, id.length() - ext.length()); } } return id; } }
DefaultSlingSimulator implements SlingSimulatorBackend, SlingSimulator { static String removeConfigExtension(final String id) { for (final String ext : EXTENSIONS) { if (id.endsWith(ext)) { return id.substring(0, id.length() - ext.length()); } } return id; }  }
DefaultSlingSimulator implements SlingSimulatorBackend, SlingSimulator { static String removeConfigExtension(final String id) { for (final String ext : EXTENSIONS) { if (id.endsWith(ext)) { return id.substring(0, id.length() - ext.length()); } } return id; }  static SlingSimulatorBackend instance(); @Override void startedScan(); @Override void setSession(final Session session); @Override void setPackageManager(final JcrPackageManager packageManager); @Override void setErrorListener(final ErrorListener errorListener); @Override @Nullable SlingInstallable dequeueInstallable(); @SuppressWarnings("unchecked") @Override @NotNull Fun.ThrowingSupplier<ResourceType> open(@NotNull final SlingOpenable<ResourceType> installable); @NotNull JcrPackage openEmbeddedPackage(@NotNull final EmbeddedPackageInstallable installable); @Override @Nullable SlingInstallable addInstallableNode(final @NotNull PackageId parentPackageId,
                                                         final @NotNull Node node); }
DefaultSlingSimulator implements SlingSimulatorBackend, SlingSimulator { static String removeConfigExtension(final String id) { for (final String ext : EXTENSIONS) { if (id.endsWith(ext)) { return id.substring(0, id.length() - ext.length()); } } return id; }  static SlingSimulatorBackend instance(); @Override void startedScan(); @Override void setSession(final Session session); @Override void setPackageManager(final JcrPackageManager packageManager); @Override void setErrorListener(final ErrorListener errorListener); @Override @Nullable SlingInstallable dequeueInstallable(); @SuppressWarnings("unchecked") @Override @NotNull Fun.ThrowingSupplier<ResourceType> open(@NotNull final SlingOpenable<ResourceType> installable); @NotNull JcrPackage openEmbeddedPackage(@NotNull final EmbeddedPackageInstallable installable); @Override @Nullable SlingInstallable addInstallableNode(final @NotNull PackageId parentPackageId,
                                                         final @NotNull Node node);  }