Konrad Windszus created SLING-12782:
---------------------------------------
Summary: ContentBuilder: Expose method to check for existence of
resource
Key: SLING-12782
URL: https://issues.apache.org/jira/browse/SLING-12782
Project: Sling
Issue Type: Improvement
Components: Testing
Affects Versions: Testing Sling Mock 3.5.4
Reporter: Konrad Windszus
The {{org.apache.sling.testing.mock.sling.builder.ContentBuilder}} does not
expose a method to check if a resource already exists with certain properties
at a specific location. This is necessary as overwriting an already existing
resource always leads to
{code}
java.lang.RuntimeException: Unable to create resource at
/content/dictionaries/i18n/en
at
org.apache.sling.testing.mock.sling.builder.ContentBuilder.resource(ContentBuilder.java:99)
at
org.apache.sling.testing.mock.sling.builder.ContentBuilder.resource(ContentBuilder.java:129)
at ...
Caused by: org.apache.sling.api.resource.PersistenceException: Path already
exists: /content/dictionaries/i18n/en
at
org.apache.sling.testing.resourceresolver.MockResourceResolver.create(MockResourceResolver.java:338)
at
org.apache.sling.testing.mock.sling.builder.ContentBuilder.resource(ContentBuilder.java:97)
... 6 more
{code}
For more complex test cases often a helper method is used from several tests to
set up the content. When a common parent for multiple resources is supposed to
be set up with specific properties one needs to do some checking.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)