You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ju...@apache.org on 2014/06/02 19:43:18 UTC
svn commit: r1599279 - in
/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models:
impl/ testmodels/interfaces/
Author: justin
Date: Mon Jun 2 17:43:18 2014
New Revision: 1599279
URL: http://svn.apache.org/r1599279
Log:
unit test improvements
Added:
sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/InvalidAdaptationsTest.java
- copied, changed from r1599272, sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ViaTest.java
sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ServicePropertiesMap.java
sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/PropertyModelWithDefaults.java
Modified:
sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ConstructorTest.java
sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/DefaultTest.java
sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/MultipleInjectorTest.java
sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java
sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/RequestInjectionTest.java
sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java
sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelInterfacesTest.java
sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ViaTest.java
Modified: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ConstructorTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ConstructorTest.java?rev=1599279&r1=1599278&r2=1599279&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ConstructorTest.java (original)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ConstructorTest.java Mon Jun 2 17:43:18 2014
@@ -59,8 +59,7 @@ public class ConstructorTest {
factory = new ModelAdapterFactory();
factory.activate(componentCtx);
- factory.bindInjector(new RequestAttributeInjector(),
- Collections.<String, Object> singletonMap(Constants.SERVICE_ID, 0L));
+ factory.bindInjector(new RequestAttributeInjector(), new ServicePropertiesMap(1, 1));
}
@Test
Modified: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/DefaultTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/DefaultTest.java?rev=1599279&r1=1599278&r2=1599279&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/DefaultTest.java (original)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/DefaultTest.java Mon Jun 2 17:43:18 2014
@@ -29,13 +29,13 @@ import org.apache.sling.models.impl.inje
import org.apache.sling.models.testmodels.classes.DefaultPrimitivesModel;
import org.apache.sling.models.testmodels.classes.DefaultStringModel;
import org.apache.sling.models.testmodels.classes.DefaultWrappersModel;
+import org.apache.sling.models.testmodels.interfaces.PropertyModelWithDefaults;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
import org.osgi.service.component.ComponentContext;
@RunWith(MockitoJUnitRunner.class)
@@ -54,8 +54,7 @@ public class DefaultTest {
when(componentCtx.getBundleContext()).thenReturn(bundleContext);
factory = new ModelAdapterFactory();
factory.activate(componentCtx);
- factory.bindInjector(new ValueMapInjector(),
- Collections.<String, Object> singletonMap(Constants.SERVICE_ID, 0L));
+ factory.bindInjector(new ValueMapInjector(), new ServicePropertiesMap(0, 0));
}
@Test
@@ -72,6 +71,20 @@ public class DefaultTest {
}
@Test
+ public void testDefaultStringValueOnInterface() {
+ ValueMap vm = new ValueMapDecorator(Collections.<String, Object>singletonMap("first", "first value"));
+
+ Resource res = mock(Resource.class);
+ when(res.adaptTo(ValueMap.class)).thenReturn(vm);
+
+ PropertyModelWithDefaults model = factory.getAdapter(res, PropertyModelWithDefaults.class);
+ assertNotNull(model);
+ assertEquals("first value", model.getFirst());
+ assertEquals("second default", model.getSecond());
+ }
+
+
+ @Test
public void testDefaultPrimitives() {
ValueMap vm = new ValueMapDecorator(Collections.<String, Object>emptyMap());
Copied: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/InvalidAdaptationsTest.java (from r1599272, sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ViaTest.java)
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/InvalidAdaptationsTest.java?p2=sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/InvalidAdaptationsTest.java&p1=sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ViaTest.java&r1=1599272&r2=1599279&rev=1599279&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ViaTest.java (original)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/InvalidAdaptationsTest.java Mon Jun 2 17:43:18 2014
@@ -16,63 +16,73 @@
*/
package org.apache.sling.models.impl;
-import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
import java.util.Collections;
+import java.util.Map;
-import org.apache.commons.lang.RandomStringUtils;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.api.wrappers.ValueMapDecorator;
+import org.apache.sling.models.annotations.Model;
+import org.apache.sling.models.impl.injectors.ChildResourceInjector;
import org.apache.sling.models.impl.injectors.ValueMapInjector;
-import org.apache.sling.models.testmodels.classes.ViaModel;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
import org.osgi.service.component.ComponentContext;
@RunWith(MockitoJUnitRunner.class)
-public class ViaTest {
-
- @Mock
- private Resource resource;
-
- @Mock
- private SlingHttpServletRequest request;
+public class InvalidAdaptationsTest {
@Mock
private ComponentContext componentCtx;
@Mock
private BundleContext bundleContext;
-
+
private ModelAdapterFactory factory;
@Before
public void setup() {
when(componentCtx.getBundleContext()).thenReturn(bundleContext);
- when(request.getResource()).thenReturn(resource);
+
factory = new ModelAdapterFactory();
factory.activate(componentCtx);
- factory.bindInjector(new ValueMapInjector(),
- Collections.<String, Object> singletonMap(Constants.SERVICE_ID, 0L));
+ factory.bindInjector(new ValueMapInjector(), new ServicePropertiesMap(1, 1));
+ factory.bindInjector(new ChildResourceInjector(), new ServicePropertiesMap(2, 0));
}
@Test
- public void testProjectionToResource() {
- String value = RandomStringUtils.randomAlphanumeric(10);
- ValueMap map = new ValueMapDecorator(Collections.<String, Object> singletonMap("firstProperty", value));
- when(resource.adaptTo(ValueMap.class)).thenReturn(map);
-
- ViaModel model = factory.getAdapter(request, ViaModel.class);
- assertNotNull(model);
- assertEquals(value, model.getFirstProperty());
+ public void testNonModelClass() {
+ Map<String, Object> emptyMap = Collections.<String, Object> emptyMap();
+
+ Resource res = mock(Resource.class);
+ when(res.adaptTo(ValueMap.class)).thenReturn(new ValueMapDecorator(emptyMap));
+
+ assertNull(factory.getAdapter(res, NonModel.class));
+ }
+
+ @Test
+ public void testWrongAdaptableClass() {
+ Map<String, Object> emptyMap = Collections.<String, Object> emptyMap();
+
+ Resource res = mock(Resource.class);
+ when(res.adaptTo(ValueMap.class)).thenReturn(new ValueMapDecorator(emptyMap));
+
+ assertNull(factory.getAdapter(res, RequestModel.class));
+ }
+
+ private class NonModel {
+ }
+
+ @Model(adaptables = SlingHttpServletRequest.class)
+ private class RequestModel {
}
}
Modified: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/MultipleInjectorTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/MultipleInjectorTest.java?rev=1599279&r1=1599278&r2=1599279&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/MultipleInjectorTest.java (original)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/MultipleInjectorTest.java Mon Jun 2 17:43:18 2014
@@ -19,7 +19,7 @@ package org.apache.sling.models.impl;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
-import java.util.Collections;
+import java.lang.reflect.AnnotatedElement;
import javax.inject.Inject;
@@ -29,6 +29,7 @@ import org.apache.sling.models.annotatio
import org.apache.sling.models.annotations.Source;
import org.apache.sling.models.impl.injectors.BindingsInjector;
import org.apache.sling.models.impl.injectors.RequestAttributeInjector;
+import org.apache.sling.models.spi.DisposalCallbackRegistry;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -36,7 +37,6 @@ import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
import org.osgi.service.component.ComponentContext;
@RunWith(MockitoJUnitRunner.class)
@@ -68,9 +68,8 @@ public class MultipleInjectorTest {
factory = new ModelAdapterFactory();
factory.activate(componentCtx);
- factory.bindInjector(bindingsInjector, Collections.<String, Object> singletonMap(Constants.SERVICE_ID, 2L));
- factory.bindInjector(attributesInjector,
- Collections.<String, Object> singletonMap(Constants.SERVICE_ID, 1L));
+ factory.bindInjector(bindingsInjector, new ServicePropertiesMap(2, 2));
+ factory.bindInjector(attributesInjector, new ServicePropertiesMap(1, 1));
when(request.getAttribute(SlingBindings.class.getName())).thenReturn(bindings);
}
@@ -89,6 +88,8 @@ public class MultipleInjectorTest {
assertEquals(obj.firstAttribute, bindingsValue);
verifyNoMoreInteractions(attributesInjector);
+ verify(bindingsInjector).getValue(eq(request), eq("firstAttribute"), eq(String.class), any(AnnotatedElement.class), any(DisposalCallbackRegistry.class));
+ verifyNoMoreInteractions(bindingsInjector);
}
@Test
Modified: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java?rev=1599279&r1=1599278&r2=1599279&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java (original)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java Mon Jun 2 17:43:18 2014
@@ -17,9 +17,9 @@
package org.apache.sling.models.impl;
import static org.junit.Assert.*;
+import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;
-import java.util.Collections;
import java.util.Dictionary;
import org.apache.sling.api.SlingHttpServletRequest;
@@ -43,7 +43,6 @@ import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleListener;
-import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
import org.osgi.service.component.ComponentContext;
@@ -70,7 +69,7 @@ public class OSGiInjectionTest {
OSGiServiceInjector injectorFactory = new OSGiServiceInjector();
injectorFactory.activate(componentCtx);
- factory.bindInjector(injectorFactory, Collections.<String, Object> singletonMap(Constants.SERVICE_ID, 0L));
+ factory.bindInjector(injectorFactory, new ServicePropertiesMap(1, 1));
bindings.setSling(helper);
}
Modified: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/RequestInjectionTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/RequestInjectionTest.java?rev=1599279&r1=1599278&r2=1599279&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/RequestInjectionTest.java (original)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/RequestInjectionTest.java Mon Jun 2 17:43:18 2014
@@ -19,8 +19,6 @@ package org.apache.sling.models.impl;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
-import java.util.Collections;
-
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.scripting.SlingBindings;
import org.apache.sling.api.scripting.SlingScriptHelper;
@@ -32,7 +30,6 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
import org.osgi.service.component.ComponentContext;
@RunWith(MockitoJUnitRunner.class)
@@ -62,8 +59,7 @@ public class RequestInjectionTest {
factory = new ModelAdapterFactory();
factory.activate(componentCtx);
- factory.bindInjector(new BindingsInjector(),
- Collections.<String, Object> singletonMap(Constants.SERVICE_ID, 0L));
+ factory.bindInjector(new BindingsInjector(), new ServicePropertiesMap(1, 1));
}
@Test
Modified: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java?rev=1599279&r1=1599278&r2=1599279&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java (original)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java Mon Jun 2 17:43:18 2014
@@ -43,7 +43,6 @@ import org.mockito.invocation.Invocation
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
import org.osgi.service.component.ComponentContext;
@RunWith(MockitoJUnitRunner.class)
@@ -63,10 +62,8 @@ public class ResourceModelClassesTest {
factory = new ModelAdapterFactory();
factory.activate(componentCtx);
- factory.bindInjector(new ValueMapInjector(),
- Collections.<String, Object> singletonMap(Constants.SERVICE_ID, 1L));
- factory.bindInjector(new ChildResourceInjector(),
- Collections.<String, Object> singletonMap(Constants.SERVICE_ID, 0L));
+ factory.bindInjector(new ValueMapInjector(), new ServicePropertiesMap(2, 2));
+ factory.bindInjector(new ChildResourceInjector(), new ServicePropertiesMap(1, 1));
}
@Test
Modified: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelInterfacesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelInterfacesTest.java?rev=1599279&r1=1599278&r2=1599279&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelInterfacesTest.java (original)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelInterfacesTest.java Mon Jun 2 17:43:18 2014
@@ -43,7 +43,6 @@ import org.mockito.invocation.Invocation
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
import org.osgi.service.component.ComponentContext;
@RunWith(MockitoJUnitRunner.class)
@@ -62,10 +61,8 @@ public class ResourceModelInterfacesTest
when(componentCtx.getBundleContext()).thenReturn(bundleContext);
factory = new ModelAdapterFactory();
factory.activate(componentCtx);
- factory.bindInjector(new ValueMapInjector(),
- Collections.<String, Object> singletonMap(Constants.SERVICE_ID, 1L));
- factory.bindInjector(new ChildResourceInjector(),
- Collections.<String, Object> singletonMap(Constants.SERVICE_ID, 0L));
+ factory.bindInjector(new ValueMapInjector(), new ServicePropertiesMap(2, 2));
+ factory.bindInjector(new ChildResourceInjector(), new ServicePropertiesMap(1, 1));
}
@Test
Added: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ServicePropertiesMap.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ServicePropertiesMap.java?rev=1599279&view=auto
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ServicePropertiesMap.java (added)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ServicePropertiesMap.java Mon Jun 2 17:43:18 2014
@@ -0,0 +1,32 @@
+/*
+ * 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.models.impl;
+
+import java.util.HashMap;
+
+import org.osgi.framework.Constants;
+
+@SuppressWarnings("serial")
+public class ServicePropertiesMap extends HashMap<String, Object> {
+
+ public ServicePropertiesMap(long serviceId, long serviceRanking) {
+ super();
+ put(Constants.SERVICE_ID, serviceId);
+ put(Constants.SERVICE_RANKING, serviceRanking);
+ }
+
+}
Modified: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ViaTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ViaTest.java?rev=1599279&r1=1599278&r2=1599279&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ViaTest.java (original)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ViaTest.java Mon Jun 2 17:43:18 2014
@@ -16,8 +16,8 @@
*/
package org.apache.sling.models.impl;
-import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
import java.util.Collections;
@@ -34,7 +34,6 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
import org.osgi.service.component.ComponentContext;
@RunWith(MockitoJUnitRunner.class)
@@ -60,8 +59,7 @@ public class ViaTest {
when(request.getResource()).thenReturn(resource);
factory = new ModelAdapterFactory();
factory.activate(componentCtx);
- factory.bindInjector(new ValueMapInjector(),
- Collections.<String, Object> singletonMap(Constants.SERVICE_ID, 0L));
+ factory.bindInjector(new ValueMapInjector(), new ServicePropertiesMap(1, 1));
}
@Test
Added: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/PropertyModelWithDefaults.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/PropertyModelWithDefaults.java?rev=1599279&view=auto
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/PropertyModelWithDefaults.java (added)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/interfaces/PropertyModelWithDefaults.java Mon Jun 2 17:43:18 2014
@@ -0,0 +1,35 @@
+/*
+ * 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.models.testmodels.interfaces;
+
+import javax.inject.Inject;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.models.annotations.Default;
+import org.apache.sling.models.annotations.Model;
+import org.apache.sling.models.annotations.Optional;
+
+@Model(adaptables = Resource.class)
+public interface PropertyModelWithDefaults {
+
+ @Inject @Optional @Default(values = "first default")
+ public String getFirst();
+
+ @Inject @Optional @Default(values = "second default")
+ public String getSecond();
+
+}