blob: 525797e76f3e6d686482b0e742e49e5c9196a9c7 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.sling.feature.extension.apiregions.api.config;
import static org.junit.Assert.assertNull;
import org.apache.sling.feature.ArtifactId;
import org.apache.sling.feature.Extension;
import org.apache.sling.feature.ExtensionState;
import org.apache.sling.feature.ExtensionType;
import org.apache.sling.feature.Feature;
import org.junit.Test;
public class ConfigurationApiTest {
@Test public void testNullFeature() {
assertNull(ConfigurationApi.getConfigurationApi((Feature)null));
}
@Test public void testNullExtension() {
assertNull(ConfigurationApi.getConfigurationApi((Extension)null));
final Feature f = new Feature(ArtifactId.parse("g:a:1.0"));
assertNull(ConfigurationApi.getConfigurationApi(f));
}
@Test(expected = IllegalArgumentException.class)
public void testWrongExtensionType() {
final Feature f = new Feature(ArtifactId.parse("g:a:1.0"));
final Extension e = new Extension(ExtensionType.TEXT, ConfigurationApi.EXTENSION_NAME, ExtensionState.OPTIONAL);
f.getExtensions().add(e);
ConfigurationApi.getConfigurationApi(f);
}
}