use of org.apache.sling.testing.mock.sling.context.models.OsgiServiceModel in project sling by apache.
the class AbstractModelAdapterFactoryUtilTest method testOsgiService.
@Test
public void testOsgiService() {
context().registerService(MimeTypeService.class, new MockMimeTypeService());
OsgiServiceModel model = context().resourceResolver().adaptTo(OsgiServiceModel.class);
assertNotNull(model);
assertNotNull(model.getMimeTypeService());
assertEquals("text/html", model.getMimeTypeService().getMimeType("html"));
}
use of org.apache.sling.testing.mock.sling.context.models.OsgiServiceModel in project sling by apache.
the class AbstractSlingContextImplTest method testSlingModelsInvalidAdapt.
@Test
public void testSlingModelsInvalidAdapt() {
OsgiServiceModel model = context.request().adaptTo(OsgiServiceModel.class);
assertNull(model);
}
use of org.apache.sling.testing.mock.sling.context.models.OsgiServiceModel in project sling by apache.
the class AbstractModelAdapterFactoryUtilTest method testInvalidAdapt.
@Test
public void testInvalidAdapt() {
OsgiServiceModel model = context().request().adaptTo(OsgiServiceModel.class);
assertNull(model);
}
use of org.apache.sling.testing.mock.sling.context.models.OsgiServiceModel in project sling by apache.
the class AbstractSlingContextImplTest method testSlingModelsOsgiService.
@Test
public void testSlingModelsOsgiService() {
context.registerService(new MockMimeTypeService());
OsgiServiceModel model = context.resourceResolver().adaptTo(OsgiServiceModel.class);
assertNotNull(model.getMimeTypeService());
assertEquals("text/html", model.getMimeTypeService().getMimeType("html"));
}
Aggregations