public void returnConfiguration()

in src/main/java/org/apache/sling/testing/junit/rules/instance/util/ConfigurationPool.java [91:117]


    public void returnConfiguration(Description description, int configurationIndex) {
        synchronized (ConfigurationPool.class) {
            if (!isTaken(configurationIndex)) {
                throw new IllegalStateException("Returned configuration is not taken by anyone");
            }

            Set<Integer> indices = takenConfigurationsByDescription.get(description);

            if (indices == null) {
                throw new IllegalStateException("The test didn't take any configuration");
            }

            if (!indices.contains(configurationIndex)) {
                throw new IllegalStateException("The returned configuration was not taken by the test");
            }

            indices.remove(configurationIndex);

            LOG.debug("Test {} returned configuration with index {}", description, configurationIndex);

            if (indices.isEmpty()) {
                takenConfigurationsByDescription.remove(description);
            }

            takenConfigurations.remove(configurationIndex);
        }
    }