AbstractDataSourceServlet extends SlingSafeMethodsServlet { @NotNull protected Resource createResource(@NotNull ResourceResolver resolver, @NotNull String textValue, @NotNull String valueValue) { ValueMap properties = new ValueMapDecorator(new HashMap<>()); properties.put("text", textValue); properties.put("value", valueValue); return new ValueMapResource(resolver, new ResourceMetadata(), RESOURCE_TYPE_NON_EXISTING, properties); }   final static String PN_COMPONENT_PATH; }
@Test public void createResourceReturnsSyntheticResource() { ResourceResolver resourceResolver = Mockito.mock(ResourceResolver.class); String title = "foobar"; String value = "qux"; AbstractDataSourceServlet dataSource = new AbstractDataSourceServlet() { @Nonnull @Override protected ExpressionResolver getExpressionResolver() { return Mockito.mock(ExpressionResolver.class); } }; Resource resource = dataSource.createResource(resourceResolver, title, value); assertEquals(title, resource.getValueMap().get("text")); assertEquals(value, resource.getValueMap().get("value")); assertEquals(Resource.RESOURCE_TYPE_NON_EXISTING, resource.getResourceType()); }