You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2025/02/26 11:05:27 UTC

(sling-org-apache-sling-resourcebuilder) 02/02: SLING-12677 apply spotless formatting

This is an automated email from the ASF dual-hosted git repository.

sseifert pushed a commit to branch feature/SLING-12677-parent-62
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourcebuilder.git

commit 560a3f3ffe0301f1373f9f6434a2ca016c255991
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Wed Feb 26 12:05:14 2025 +0100

    SLING-12677 apply spotless formatting
---
 pom.xml                                            | 124 ++++----
 .../sling/resourcebuilder/api/ResourceBuilder.java |  70 +++--
 .../api/ResourceBuilderFactory.java                |  15 +-
 .../resourcebuilder/impl/MapArgsConverter.java     |  11 +-
 .../impl/ResourceBuilderFactoryService.java        |   7 +-
 .../resourcebuilder/impl/ResourceBuilderImpl.java  | 109 ++++---
 .../resourcebuilder/impl/MapArgsConverterTest.java |  14 +-
 .../impl/ResourceBuilderImplTest.java              | 312 ++++++++++-----------
 .../sling/resourcebuilder/it/FileRetrievalIT.java  |  31 +-
 .../resourcebuilder/it/ResourceBuilderIT.java      |  42 ++-
 .../it/ResourceBuilderTestSupport.java             |  40 +--
 .../resourcebuilder/test/ResourceAssertions.java   |  83 +++---
 12 files changed, 421 insertions(+), 437 deletions(-)

diff --git a/pom.xml b/pom.xml
index 4d8f216..d6bfe40 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,69 +32,18 @@
 
     <name>Apache Sling Resource Builder</name>
     <description>Utilities to create Sling content</description>
+    <scm>
+        <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourcebuilder.git</connection>
+        <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourcebuilder.git</developerConnection>
+        <tag>HEAD</tag>
+        <url>https://github.com/apache/sling-org-apache-sling-resourcebuilder.git</url>
+    </scm>
 
     <properties>
         <org.ops4j.pax.exam.version>4.13.4</org.ops4j.pax.exam.version>
         <sling.java.version>11</sling.java.version>
         <project.build.outputTimestamp>2025-02-26T00:00:00Z</project.build.outputTimestamp>
     </properties>
-    <scm>
-        <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourcebuilder.git</connection>
-        <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourcebuilder.git</developerConnection>
-        <url>https://github.com/apache/sling-org-apache-sling-resourcebuilder.git</url>
-        <tag>HEAD</tag>
-    </scm>
-    
-    <build>
-        <plugins>
-            <!-- Copy compiled classes only for paxexam integration tests-->
-            <plugin>
-                <artifactId>maven-resources-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>copy-resources</id>
-                        <phase>compile</phase>
-                        <goals>
-                            <goal>copy-resources</goal>
-                        </goals>
-                        <configuration>
-                            <outputDirectory>
-                                ${project.build.outputDirectory}/../test-classes/org/apache/sling/resourcebuilder/impl
-                            </outputDirectory>
-                            <resources>
-                                <resource>
-                                    <directory>
-                                        ${project.build.outputDirectory}/org/apache/sling/resourcebuilder/impl
-                                    </directory>
-                                </resource>
-                            </resources>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <artifactId>maven-failsafe-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>integration-test</goal>
-                            <goal>verify</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <configuration>
-                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
-                    <systemPropertyVariables combine.children="append">
-                        <bundle.filename>${basedir}/target/${project.build.finalName}.jar</bundle.filename>
-                    </systemPropertyVariables>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.servicemix.tooling</groupId>
-                <artifactId>depends-maven-plugin</artifactId>
-            </plugin>
-         </plugins>
-    </build>
 
     <dependencies>
         <dependency>
@@ -134,44 +83,44 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.paxexam</artifactId>
-            <scope>test</scope>
             <version>4.0.0</version>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
             <artifactId>pax-exam</artifactId>
-            <scope>test</scope>
             <version>${org.ops4j.pax.exam.version}</version>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
             <artifactId>pax-exam-cm</artifactId>
-            <scope>test</scope>
             <version>${org.ops4j.pax.exam.version}</version>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
             <artifactId>pax-exam-container-forked</artifactId>
-            <scope>test</scope>
             <version>${org.ops4j.pax.exam.version}</version>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
             <artifactId>pax-exam-junit4</artifactId>
-            <scope>test</scope>
             <version>${org.ops4j.pax.exam.version}</version>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
             <artifactId>pax-exam-link-mvn</artifactId>
-            <scope>test</scope>
             <version>${org.ops4j.pax.exam.version}</version>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.framework</artifactId>
-            <scope>test</scope>
             <version>7.0.5</version>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>javax.inject</groupId>
@@ -214,4 +163,51 @@
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <!-- Copy compiled classes only for paxexam integration tests-->
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-resources</id>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <phase>compile</phase>
+                        <configuration>
+                            <outputDirectory>${project.build.outputDirectory}/../test-classes/org/apache/sling/resourcebuilder/impl</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.build.outputDirectory}/org/apache/sling/resourcebuilder/impl</directory>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <configuration>
+                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
+                    <systemPropertyVariables combine.children="append">
+                        <bundle.filename>${basedir}/target/${project.build.finalName}.jar</bundle.filename>
+                    </systemPropertyVariables>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>integration-test</goal>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.servicemix.tooling</groupId>
+                <artifactId>depends-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>
diff --git a/src/main/java/org/apache/sling/resourcebuilder/api/ResourceBuilder.java b/src/main/java/org/apache/sling/resourcebuilder/api/ResourceBuilder.java
index 0c3f9f2..e9a7561 100644
--- a/src/main/java/org/apache/sling/resourcebuilder/api/ResourceBuilder.java
+++ b/src/main/java/org/apache/sling/resourcebuilder/api/ResourceBuilder.java
@@ -29,29 +29,31 @@ import org.osgi.annotation.versioning.ProviderType;
 /** Builds Sling Resources using a simple fluent API */
 @ProviderType
 public interface ResourceBuilder {
-    
+
     /** Default primary type for resources created by this builder */
     public static final String DEFAULT_PRIMARY_TYPE = "nt:unstructured";
-    
-    /** Create a Resource, which optionally becomes the current 
-     *  parent Resource. 
+
+    /** Create a Resource, which optionally becomes the current
+     *  parent Resource.
      * @param path The path of the Resource to create.
      *    If it's a relative path this builder's current resource is used as parent.
      *    Otherwise the resource is created ad the given absolute path.
-     * @param properties optional name-value pairs 
+     * @param properties optional name-value pairs
      * @return this builder
      */
-    @NotNull ResourceBuilder resource(@NotNull String path, @NotNull Object @NotNull ... properties);
+    @NotNull
+    ResourceBuilder resource(@NotNull String path, @NotNull Object @NotNull ... properties);
 
-    /** Create a Resource, which optionally becomes the current 
-     *  parent Resource. 
+    /** Create a Resource, which optionally becomes the current
+     *  parent Resource.
      * @param path The path of the Resource to create.
      *    If it's a relative path this builder's current resource is used as parent.
      *    Otherwise the resource is created ad the given absolute path.
-     * @param properties Name-value pairs 
+     * @param properties Name-value pairs
      * @return this builder
      */
-    @NotNull ResourceBuilder resource(@NotNull String path, @NotNull Map<String, Object> properties);
+    @NotNull
+    ResourceBuilder resource(@NotNull String path, @NotNull Map<String, Object> properties);
 
     /** Create a file under the current parent resource
      * @param filename The name of the created file
@@ -60,45 +62,53 @@ public interface ResourceBuilder {
      * @param lastModified if &lt; 0, current time is used
      * @return this builder
      */
-    @NotNull ResourceBuilder file(@NotNull String filename, @NotNull InputStream data, @Nullable String mimeType, long lastModified);
-    
-    /** Create a file under the current parent resource. Mime type is set using the 
+    @NotNull
+    ResourceBuilder file(
+            @NotNull String filename, @NotNull InputStream data, @Nullable String mimeType, long lastModified);
+
+    /** Create a file under the current parent resource. Mime type is set using the
      *  Sling MimeTypeService, and last modified is set to current time.
      * @param filename The name of the created file
      * @param data The file data
      * @return this builder
      */
-    @NotNull ResourceBuilder file(@NotNull String filename, @NotNull InputStream data);
-    
+    @NotNull
+    ResourceBuilder file(@NotNull String filename, @NotNull InputStream data);
+
     /** Commit created resources */
-    @NotNull ResourceBuilder commit();
-    
+    @NotNull
+    ResourceBuilder commit();
+
     /** Set the primary type for intermediate resources created
      *  when the parent of resource being created does not exist.
      * @param primaryType If null the DEFAULT_PRIMARY_TYPE is used.
      * @return this builder
      */
-    @NotNull ResourceBuilder withIntermediatePrimaryType(@Nullable String primaryType);
-    
-    /** Set siblings mode (as opposed to hierarchy mode) where creating a resource 
+    @NotNull
+    ResourceBuilder withIntermediatePrimaryType(@Nullable String primaryType);
+
+    /** Set siblings mode (as opposed to hierarchy mode) where creating a resource
      *  doesn't change the current parent. Used to create flat structures.
      *  This is off by default.
      * @return this builder
      */
-    @NotNull ResourceBuilder siblingsMode();
-    
-    /** Set hierarchy mode (as opposed to siblings mode) where creating a resource 
+    @NotNull
+    ResourceBuilder siblingsMode();
+
+    /** Set hierarchy mode (as opposed to siblings mode) where creating a resource
      *  sets it as the current parent. Used to create tree structures.
      *  This is on by default.
      * @return this builder
      */
-    @NotNull ResourceBuilder hierarchyMode();
-    
+    @NotNull
+    ResourceBuilder hierarchyMode();
+
     /** Return the current parent resource */
-    @NotNull Resource getCurrentParent();
-    
-    /** Reset the current parent Resource to the original one.
-     *  Also activates hierarchyMode which is the default mode. */ 
-    @NotNull ResourceBuilder atParent();
+    @NotNull
+    Resource getCurrentParent();
 
+    /** Reset the current parent Resource to the original one.
+     *  Also activates hierarchyMode which is the default mode. */
+    @NotNull
+    ResourceBuilder atParent();
 }
diff --git a/src/main/java/org/apache/sling/resourcebuilder/api/ResourceBuilderFactory.java b/src/main/java/org/apache/sling/resourcebuilder/api/ResourceBuilderFactory.java
index cc50cbd..d3a2b76 100644
--- a/src/main/java/org/apache/sling/resourcebuilder/api/ResourceBuilderFactory.java
+++ b/src/main/java/org/apache/sling/resourcebuilder/api/ResourceBuilderFactory.java
@@ -28,16 +28,17 @@ import org.osgi.annotation.versioning.ProviderType;
  */
 @ProviderType
 public interface ResourceBuilderFactory {
-    
-    /** Start a ResourceBuilder using the supplied parent resource 
+
+    /** Start a ResourceBuilder using the supplied parent resource
      *  @return the new builder
      * */
-    @NotNull ResourceBuilder forParent(@NotNull Resource parent);
-    
+    @NotNull
+    ResourceBuilder forParent(@NotNull Resource parent);
+
     /** Start a ResourceBuilder using the supplied ResourceResolver,
-     *  starting with the root resource as the builder's parent resource. 
+     *  starting with the root resource as the builder's parent resource.
      *  @return the new builder
      * */
-    @NotNull ResourceBuilder forResolver(@NotNull ResourceResolver r);
-    
+    @NotNull
+    ResourceBuilder forResolver(@NotNull ResourceResolver r);
 }
diff --git a/src/main/java/org/apache/sling/resourcebuilder/impl/MapArgsConverter.java b/src/main/java/org/apache/sling/resourcebuilder/impl/MapArgsConverter.java
index 3966f6e..8f3b69a 100644
--- a/src/main/java/org/apache/sling/resourcebuilder/impl/MapArgsConverter.java
+++ b/src/main/java/org/apache/sling/resourcebuilder/impl/MapArgsConverter.java
@@ -29,18 +29,17 @@ import org.jetbrains.annotations.NotNull;
  *  to simplify our builder's syntax.
  */
 public class MapArgsConverter {
-    
+
     /** Convert an args list to a Map */
     @SuppressWarnings("null")
     public static @NotNull Map<String, Object> toMap(@NotNull Object @NotNull ... args) {
-        if(args.length % 2 != 0) {
+        if (args.length % 2 != 0) {
             throw new IllegalArgumentException("args must be an even number of name/values:" + Arrays.asList(args));
         }
         final Map<String, Object> result = new HashMap<String, Object>();
-        for(int i=0 ; i < args.length; i+=2) {
-            result.put(args[i].toString(), args[i+1]);
+        for (int i = 0; i < args.length; i += 2) {
+            result.put(args[i].toString(), args[i + 1]);
         }
         return Collections.unmodifiableMap(result);
     }
-
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/apache/sling/resourcebuilder/impl/ResourceBuilderFactoryService.java b/src/main/java/org/apache/sling/resourcebuilder/impl/ResourceBuilderFactoryService.java
index 1046ddf..eb108a1 100644
--- a/src/main/java/org/apache/sling/resourcebuilder/impl/ResourceBuilderFactoryService.java
+++ b/src/main/java/org/apache/sling/resourcebuilder/impl/ResourceBuilderFactoryService.java
@@ -32,10 +32,10 @@ import org.osgi.service.component.annotations.Reference;
  */
 @Component(service = ResourceBuilderFactory.class)
 public class ResourceBuilderFactoryService implements ResourceBuilderFactory {
-    
+
     @Reference
     private MimeTypeService mimeTypeService;
-    
+
     @SuppressWarnings("null")
     @Override
     public @NotNull ResourceBuilder forParent(@NotNull Resource parent) {
@@ -45,10 +45,9 @@ public class ResourceBuilderFactoryService implements ResourceBuilderFactory {
     @Override
     public @NotNull ResourceBuilder forResolver(@NotNull ResourceResolver r) {
         final Resource root = r.getResource("/");
-        if(root == null) {
+        if (root == null) {
             throw new IllegalStateException("Cannot read root resource");
         }
         return forParent(root);
     }
-
 }
diff --git a/src/main/java/org/apache/sling/resourcebuilder/impl/ResourceBuilderImpl.java b/src/main/java/org/apache/sling/resourcebuilder/impl/ResourceBuilderImpl.java
index 17ed5fd..e3d3a39 100644
--- a/src/main/java/org/apache/sling/resourcebuilder/impl/ResourceBuilderImpl.java
+++ b/src/main/java/org/apache/sling/resourcebuilder/impl/ResourceBuilderImpl.java
@@ -41,7 +41,7 @@ public class ResourceBuilderImpl implements ResourceBuilder {
     private @NotNull Resource currentParent;
     private String intermediatePrimaryType;
     private boolean hierarchyMode;
-    
+
     public static final String JCR_PRIMARYTYPE = "jcr:primaryType";
     public static final String JCR_MIMETYPE = "jcr:mimeType";
     public static final String JCR_LASTMODIFIED = "jcr:lastModified";
@@ -49,13 +49,13 @@ public class ResourceBuilderImpl implements ResourceBuilder {
     public static final String JCR_CONTENT = "jcr:content";
     public static final String NT_RESOURCE = "nt:resource";
     public static final String NT_FILE = "nt:file";
-    
+
     public static final String CANNOT_RESTART =
             "Cannot reset the parent resource or resource resolver, please create a new "
-            + "builder using the ResourceBuilder service";
-    
+                    + "builder using the ResourceBuilder service";
+
     private final @NotNull MimeTypeService mimeTypeService;
-    
+
     public ResourceBuilderImpl(@NotNull Resource parent, @NotNull MimeTypeService mts) {
         mimeTypeService = mts;
         if (parent == null) {
@@ -67,16 +67,16 @@ public class ResourceBuilderImpl implements ResourceBuilder {
         currentParent = parent;
         hierarchyMode = true;
     }
-    
-    private @NotNull ResourceBuilderImpl cloneResourceBuilder(@NotNull Resource newCurrentParent,
-            @Nullable String newIntermediatePrimaryType, boolean newHierarchyMode) {
+
+    private @NotNull ResourceBuilderImpl cloneResourceBuilder(
+            @NotNull Resource newCurrentParent, @Nullable String newIntermediatePrimaryType, boolean newHierarchyMode) {
         ResourceBuilderImpl clone = new ResourceBuilderImpl(originalParent, mimeTypeService);
         clone.currentParent = newCurrentParent;
         clone.intermediatePrimaryType = newIntermediatePrimaryType;
         clone.hierarchyMode = newHierarchyMode;
         return clone;
     }
-    
+
     @Override
     public @NotNull Resource getCurrentParent() {
         return currentParent;
@@ -86,67 +86,61 @@ public class ResourceBuilderImpl implements ResourceBuilder {
     public @NotNull ResourceBuilder atParent() {
         return cloneResourceBuilder(originalParent, this.intermediatePrimaryType, true);
     }
-    
+
     private boolean isAbsolutePath(String path) {
         return path.startsWith("/") && !path.contains("..");
     }
 
     private void checkRelativePath(String path) {
-        if(path.startsWith("/")) {
+        if (path.startsWith("/")) {
             throw new IllegalArgumentException("Path is not relative:" + path);
         }
-        if(path.contains("..")) {
+        if (path.contains("..")) {
             throw new IllegalArgumentException("Path contains invalid pattern '..': " + path);
         }
     }
 
     private String parentPath(String relativePath) {
         final String parentPath = currentParent.getPath();
-        final String fullPath = 
-            parentPath.endsWith("/")  ? 
-            parentPath + relativePath : 
-            parentPath + "/" + relativePath;
+        final String fullPath = parentPath.endsWith("/") ? parentPath + relativePath : parentPath + "/" + relativePath;
         return ResourceUtil.getParent(fullPath);
     }
-    
+
     @Override
-    public @NotNull ResourceBuilder resource(@NotNull String path, @NotNull Map<String,Object> properties) {
+    public @NotNull ResourceBuilder resource(@NotNull String path, @NotNull Map<String, Object> properties) {
         Resource r = null;
-        
+
         final String parentPath;
         final String fullPath;
         boolean absolutePath = isAbsolutePath(path);
         if (absolutePath) {
             parentPath = ResourceUtil.getParent(path);
             fullPath = path;
-        }
-        else {
+        } else {
             checkRelativePath(path);
             parentPath = parentPath(path);
             fullPath = currentParent.getPath() + "/" + path;
         }
         final Resource myParent = ensureResourceExists(parentPath);
-        
+
         try {
             r = currentParent.getResourceResolver().getResource(fullPath);
             if (r == null) {
-                r = currentParent.getResourceResolver().create(myParent, 
-                        ResourceUtil.getName(fullPath), properties);
+                r = currentParent.getResourceResolver().create(myParent, ResourceUtil.getName(fullPath), properties);
             } else {
                 // Resource exists, set our properties
                 final ModifiableValueMap mvm = r.adaptTo(ModifiableValueMap.class);
                 if (mvm == null) {
                     throw new IllegalStateException("Cannot modify properties of " + r.getPath());
                 }
-                for(Map.Entry <String, Object> e : properties.entrySet()) {
+                for (Map.Entry<String, Object> e : properties.entrySet()) {
                     mvm.put(e.getKey(), e.getValue());
                 }
             }
-        } catch(PersistenceException pex) {
-            throw new RuntimeException(
-                    "PersistenceException while creating Resource " + fullPath, pex);
+        } catch (PersistenceException pex) {
+            throw new RuntimeException("PersistenceException while creating Resource " + fullPath, pex);
         }
-        
+
         if (r == null) {
             throw new RuntimeException("Failed to get or create resource " + fullPath);
         } else if (hierarchyMode || absolutePath) {
@@ -154,21 +148,19 @@ public class ResourceBuilderImpl implements ResourceBuilder {
         }
         return this;
     }
-    
+
     @SuppressWarnings("unchecked")
     @Override
     public @NotNull ResourceBuilder resource(@NotNull String path, @NotNull Object @NotNull ... properties) {
         if (properties == null || properties.length == 0) {
             return resource(path, ValueMap.EMPTY);
-        }
-        else if (properties.length == 1 && properties[0] instanceof Map) {
-            return resource(path, (Map<String,Object>)properties[0]);
-        }
-        else {
+        } else if (properties.length == 1 && properties[0] instanceof Map) {
+            return resource(path, (Map<String, Object>) properties[0]);
+        } else {
             return resource(path, MapArgsConverter.toMap(properties));
         }
     }
-    
+
     /** Create a Resource at the specified path if none exists yet,
      *  using the current intermediate primary type. "Stolen" from
      *  the sling-mock module's ContentBuilder class.
@@ -176,7 +168,7 @@ public class ResourceBuilderImpl implements ResourceBuilder {
      *  @return Resource at path (existing or newly created)
      */
     protected final Resource ensureResourceExists(String path) {
-        if(path == null || path.length() == 0 || path.equals("/")) {
+        if (path == null || path.length() == 0 || path.equals("/")) {
             return resourceResolver.getResource("/");
         }
         Resource resource = resourceResolver.getResource(path);
@@ -188,65 +180,65 @@ public class ResourceBuilderImpl implements ResourceBuilder {
         Resource parentResource = ensureResourceExists(parentPath);
         try {
             resource = resourceResolver.create(
-                    parentResource, 
-                    name, 
-                    MapArgsConverter.toMap(JCR_PRIMARYTYPE, intermediatePrimaryType));
+                    parentResource, name, MapArgsConverter.toMap(JCR_PRIMARYTYPE, intermediatePrimaryType));
             return resource;
         } catch (PersistenceException ex) {
             throw new RuntimeException("Unable to create intermediate resource at " + path, ex);
         }
     }
-    
+
     protected String getMimeType(String filename, String userSuppliedMimeType) {
-        if(userSuppliedMimeType != null) {
+        if (userSuppliedMimeType != null) {
             return userSuppliedMimeType;
         }
         return mimeTypeService.getMimeType(filename);
     }
-    
+
     protected long getLastModified(long userSuppliedValue) {
-        if(userSuppliedValue < 0) {
+        if (userSuppliedValue < 0) {
             return System.currentTimeMillis();
         }
         return userSuppliedValue;
     }
-    
+
     @Override
-    public @NotNull ResourceBuilder file(@NotNull String relativePath, @NotNull InputStream data, @Nullable String mimeType, long lastModified) {
+    public @NotNull ResourceBuilder file(
+            @NotNull String relativePath, @NotNull InputStream data, @Nullable String mimeType, long lastModified) {
         checkRelativePath(relativePath);
         final String name = ResourceUtil.getName(relativePath);
-        if(data == null) {
+        if (data == null) {
             throw new IllegalArgumentException("Data is null for file " + name);
         }
-        
+
         Resource file = null;
         final ResourceResolver resolver = currentParent.getResourceResolver();
         final String parentPath = parentPath(relativePath);
-        
+
         final Resource parent = ensureResourceExists(parentPath);
         try {
             final String fullPath = currentParent.getPath() + "/" + name;
-            if(resolver.getResource(fullPath) != null) {
+            if (resolver.getResource(fullPath) != null) {
                 throw new IllegalStateException("Resource already exists:" + fullPath);
             }
             final Map<String, Object> fileProps = new HashMap<String, Object>();
             fileProps.put(JCR_PRIMARYTYPE, NT_FILE);
             file = resolver.create(parent, name, fileProps);
-            
+
             final Map<String, Object> contentProps = new HashMap<String, Object>();
             contentProps.put(JCR_PRIMARYTYPE, NT_RESOURCE);
             contentProps.put(JCR_MIMETYPE, getMimeType(name, mimeType));
             contentProps.put(JCR_LASTMODIFIED, getLastModified(lastModified));
             contentProps.put(JCR_DATA, data);
-            resolver.create(file, JCR_CONTENT, contentProps); 
-        } catch(PersistenceException pex) {
+            resolver.create(file, JCR_CONTENT, contentProps);
+        } catch (PersistenceException pex) {
             throw new RuntimeException("Unable to create file under " + currentParent.getPath(), pex);
         }
-        
-        if(file == null) {
-            throw new RuntimeException("Unable to get or created file resource " + relativePath + " under " + currentParent.getPath());
+
+        if (file == null) {
+            throw new RuntimeException(
+                    "Unable to get or created file resource " + relativePath + " under " + currentParent.getPath());
         }
-        if(hierarchyMode) {
+        if (hierarchyMode) {
             return cloneResourceBuilder(file, this.intermediatePrimaryType, this.hierarchyMode);
         }
         return this;
@@ -272,7 +264,7 @@ public class ResourceBuilderImpl implements ResourceBuilder {
     public @NotNull ResourceBuilder hierarchyMode() {
         return cloneResourceBuilder(currentParent, intermediatePrimaryType, true);
     }
-    
+
     @Override
     public @NotNull ResourceBuilder commit() {
         try {
@@ -282,5 +274,4 @@ public class ResourceBuilderImpl implements ResourceBuilder {
         }
         return this;
     }
-
 }
diff --git a/src/test/java/org/apache/sling/resourcebuilder/impl/MapArgsConverterTest.java b/src/test/java/org/apache/sling/resourcebuilder/impl/MapArgsConverterTest.java
index ec1a411..2cb0413 100644
--- a/src/test/java/org/apache/sling/resourcebuilder/impl/MapArgsConverterTest.java
+++ b/src/test/java/org/apache/sling/resourcebuilder/impl/MapArgsConverterTest.java
@@ -18,16 +18,16 @@
  */
 package org.apache.sling.resourcebuilder.impl;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 import java.util.Map;
 
 import org.apache.sling.api.resource.PersistenceException;
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 public class MapArgsConverterTest {
-    
+
     @Test
     public void validArguments() throws PersistenceException {
         final Map<String, Object> m = MapArgsConverter.toMap("foo", "bar", "count", 21);
@@ -35,14 +35,14 @@ public class MapArgsConverterTest {
         assertEquals("bar", m.get("foo"));
         assertEquals(21, m.get("count"));
     }
-    
+
     @Test
     public void noArguments() throws PersistenceException {
         final Map<String, Object> m = MapArgsConverter.toMap();
         assertTrue(m.isEmpty());
     }
-    
-    @Test(expected=IllegalArgumentException.class)
+
+    @Test(expected = IllegalArgumentException.class)
     public void barArguments() throws PersistenceException {
         MapArgsConverter.toMap("foo", "bar", "count");
     }
diff --git a/src/test/java/org/apache/sling/resourcebuilder/impl/ResourceBuilderImplTest.java b/src/test/java/org/apache/sling/resourcebuilder/impl/ResourceBuilderImplTest.java
index 77e7ddd..8413156 100644
--- a/src/test/java/org/apache/sling/resourcebuilder/impl/ResourceBuilderImplTest.java
+++ b/src/test/java/org/apache/sling/resourcebuilder/impl/ResourceBuilderImplTest.java
@@ -18,12 +18,6 @@
  */
 package org.apache.sling.resourcebuilder.impl;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.when;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Random;
@@ -44,29 +38,35 @@ import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.when;
+
 @RunWith(MockitoJUnitRunner.class)
 @SuppressWarnings("null")
 public class ResourceBuilderImplTest {
-    
+
     private String testRootPath;
     private long lastModified;
     private Random random = new Random(System.currentTimeMillis());
     private ResourceAssertions A;
-    
+
     @Mock
     private MimeTypeService mimeTypeService;
-    
+
     private ResourceResolver resourceResolver;
-    
+
     private Resource getTestRoot(String path) throws PersistenceException {
         final Resource root = resourceResolver.resolve("/");
         assertNotNull("Expecting non-null root", root);
         return resourceResolver.create(root, ResourceUtil.getName(path), null);
     }
-    
+
     private ResourceBuilderImpl getBuilder(String path) throws Exception {
         lastModified = random.nextLong();
-        
+
         final Resource parent = getTestRoot(path);
         final ResourceBuilderImpl result = new ResourceBuilderImpl(parent, mimeTypeService) {
             @Override
@@ -74,11 +74,11 @@ public class ResourceBuilderImplTest {
                 final long now = System.currentTimeMillis();
                 final long superValue = super.getLastModified(-1);
                 final long maxDelta = 60 * 1000L;
-                if(superValue < now || superValue - now > maxDelta) {
+                if (superValue < now || superValue - now > maxDelta) {
                     fail("getLastModified does not seem to use current time as its default value");
                 }
-                
-                if(userSuppliedValue >= 0) {
+
+                if (userSuppliedValue >= 0) {
                     return super.getLastModified(userSuppliedValue);
                 }
                 return lastModified;
@@ -86,108 +86,103 @@ public class ResourceBuilderImplTest {
         };
         return result;
     }
-    
+
     @Before
     public void setup() throws Exception {
         when(mimeTypeService.getMimeType(anyString())).thenReturn("application/javascript");
         resourceResolver = new MockResourceResolverFactory().getResourceResolver(null);
-        
+
         testRootPath = "/" + UUID.randomUUID().toString();
         A = new ResourceAssertions(testRootPath, resourceResolver);
     }
-    
+
     @After
     public void cleanup() throws PersistenceException {
         final Resource r = resourceResolver.getResource(testRootPath);
-        if(r != null) {
+        if (r != null) {
             resourceResolver.delete(r);
             resourceResolver.commit();
         }
     }
-    
+
     @Test
     public void basicResource() throws Exception {
-        getBuilder(testRootPath)
-            .resource("child", "title", "foo")
-            .commit();
-        
+        getBuilder(testRootPath).resource("child", "title", "foo").commit();
+
         A.assertProperties("child", "title", "foo");
         assertEquals(A.fullPath("child"), A.assertResource("child").getPath());
     }
-    
+
     @Test
     public void basicResourceWithMap() throws Exception {
-        Map<String,Object> props = new HashMap<String,Object>();
+        Map<String, Object> props = new HashMap<String, Object>();
         props.put("title", "foo");
-        getBuilder(testRootPath)
-            .resource("child", props)
-            .commit();
-        
+        getBuilder(testRootPath).resource("child", props).commit();
+
         A.assertProperties("child", "title", "foo");
         assertEquals(A.fullPath("child"), A.assertResource("child").getPath());
     }
-    
+
     @Test
     public void ensureResourceExists() throws Exception {
-        
+
         class MyResourceBuilder extends ResourceBuilderImpl {
             MyResourceBuilder() {
                 super(resourceResolver.getResource("/"), null);
             }
-            
+
             Resource r(String path) {
                 return ensureResourceExists(path);
             }
-        };
+        }
+        ;
         final MyResourceBuilder b = new MyResourceBuilder();
-        
+
         assertEquals("/", b.r(null).getPath());
         assertEquals("/", b.r("").getPath());
         assertEquals("/", b.r("/").getPath());
     }
-    
+
     @Test
     public void deepResource() throws Exception {
-        getBuilder(testRootPath)
-            .resource("a/b/c", "title", "foo")
-            .commit();
-        
+        getBuilder(testRootPath).resource("a/b/c", "title", "foo").commit();
+
         A.assertProperties("a/b/c", "title", "foo");
         assertEquals(A.fullPath("a/b/c"), A.assertResource("a/b/c").getPath());
         A.assertResource("a/b");
         A.assertResource("a");
     }
-    
+
     @Test
     public void intermediatePrimaryTypes() throws Exception {
         getBuilder(testRootPath)
-            .resource("a/b/c")
-            .withIntermediatePrimaryType("foo")
-            .resource("d/e")
-            .withIntermediatePrimaryType(null)
-            .resource("f/g")
-            .commit();
-        
+                .resource("a/b/c")
+                .withIntermediatePrimaryType("foo")
+                .resource("d/e")
+                .withIntermediatePrimaryType(null)
+                .resource("f/g")
+                .commit();
+
         A.assertProperties("a/b", ResourceBuilderImpl.JCR_PRIMARYTYPE, "nt:unstructured");
         A.assertProperties("a/b/c/d", ResourceBuilderImpl.JCR_PRIMARYTYPE, "foo");
         A.assertProperties("a/b/c/d/e/f", ResourceBuilderImpl.JCR_PRIMARYTYPE, "nt:unstructured");
     }
-    
+
     @Test
     public void resetParent() throws Exception {
         getBuilder(testRootPath)
-            .resource("a/b/c")
-            .siblingsMode()
-            .resource("one")
-            .resource("two")
-            .atParent()  // also sets hierarchyMode
-            .resource("d/e")
-            .resource("f/g")
-            .siblingsMode()
-            .resource("three")
-            .resource("four")
-            .commit();
-        
+                .resource("a/b/c")
+                .siblingsMode()
+                .resource("one")
+                .resource("two")
+                .atParent() // also sets hierarchyMode
+                .resource("d/e")
+                .resource("f/g")
+                .siblingsMode()
+                .resource("three")
+                .resource("four")
+                .commit();
+
         A.assertResource("a/b/c");
         A.assertResource("a/b/c/one");
         A.assertResource("a/b/c/two");
@@ -196,54 +191,51 @@ public class ResourceBuilderImplTest {
         A.assertResource("d/e/f/g/three");
         A.assertResource("d/e/f/g/four");
     }
-    
+
     @Test
     public void noResetParent() throws Exception {
-        getBuilder(testRootPath)
-            .resource("a/b/c")
-            .resource("d/e")
-            .commit();
-        
+        getBuilder(testRootPath).resource("a/b/c").resource("d/e").commit();
+
         A.assertResource("a/b/c");
         A.assertResource("a/b/c/d/e");
     }
-    
+
     @Test
     public void getParent() throws Exception {
         final Resource parent = getBuilder(testRootPath).getCurrentParent();
         assertNotNull(parent);
         assertEquals(testRootPath, parent.getPath());
     }
-    
-    @Test(expected=RuntimeException.class)
+
+    @Test(expected = RuntimeException.class)
     public void missingParentFails() throws Exception {
         new ResourceBuilderImpl(null, null).resource("foo");
     }
-    
-    @Test(expected=IllegalArgumentException.class)
+
+    @Test(expected = IllegalArgumentException.class)
     public void aboveParentFails() throws Exception {
         getBuilder(testRootPath).resource("../foo");
     }
-    
-    @Test(expected=IllegalArgumentException.class)
+
+    @Test(expected = IllegalArgumentException.class)
     public void aboveParentFailsFile() throws Exception {
         getBuilder(testRootPath).file("../foo.js", null);
     }
-    
+
     @Test
     public void simpleTree() throws Exception {
         getBuilder(testRootPath)
-            .resource("a/b/c", "title", "foo", "count", 21)
-            .siblingsMode()
-            .resource("1")
-            .resource("2")
-            .resource("3")
-            .hierarchyMode()
-            .resource("with")
-            .resource("more/here", "it", "worked")
-            .resource("deepest", "it", "worked")
-            .commit();
-        
+                .resource("a/b/c", "title", "foo", "count", 21)
+                .siblingsMode()
+                .resource("1")
+                .resource("2")
+                .resource("3")
+                .hierarchyMode()
+                .resource("with")
+                .resource("more/here", "it", "worked")
+                .resource("deepest", "it", "worked")
+                .commit();
+
         A.assertProperties("a/b/c", "count", 21, "title", "foo");
         A.assertProperties("a/b/c/with/more/here", "it", "worked");
         A.assertResource("a/b/c/with/more/here/deepest");
@@ -251,100 +243,86 @@ public class ResourceBuilderImplTest {
         A.assertResource("a/b/c/2");
         A.assertResource("a/b/c/3");
     }
-    
+
     @Test
     public void treeWithFiles() throws Exception {
         getBuilder(testRootPath)
-            .resource("apps/myapp/components/resource")
-            .siblingsMode()
-            .file("models.js", getClass().getResourceAsStream("/files/models.js"), "MT1", 42)
-            .file("text.html", getClass().getResourceAsStream("/files/text.html"), "MT2", 43)
-            .atParent()
-            .file("apps/myapp.json", getClass().getResourceAsStream("/files/myapp.json"), "MT3", 44)
-            .atParent()
-            .resource("apps/content/myapp/resource")
-            .atParent()
-            .resource("apps/content", "title", "foo")
-            .file("myapp.json", getClass().getResourceAsStream("/files/myapp.json"), "MT4", 45)
-            .commit()
-            ;
-        
+                .resource("apps/myapp/components/resource")
+                .siblingsMode()
+                .file("models.js", getClass().getResourceAsStream("/files/models.js"), "MT1", 42)
+                .file("text.html", getClass().getResourceAsStream("/files/text.html"), "MT2", 43)
+                .atParent()
+                .file("apps/myapp.json", getClass().getResourceAsStream("/files/myapp.json"), "MT3", 44)
+                .atParent()
+                .resource("apps/content/myapp/resource")
+                .atParent()
+                .resource("apps/content", "title", "foo")
+                .file("myapp.json", getClass().getResourceAsStream("/files/myapp.json"), "MT4", 45)
+                .commit();
+
         A.assertResource("apps/content/myapp/resource");
         A.assertResource("apps/myapp/components/resource");
         A.assertProperties("apps/content", "title", "foo");
-        
-        A.assertFile("apps/myapp/components/resource/models.js", 
-                "MT1", "function someJavascriptFunction()", 42L);
-        A.assertFile("apps/myapp/components/resource/text.html", 
-                "MT2", "This is an html file", 43L);
-        A.assertFile("apps/myapp.json", 
-                "MT3", "\"sling:resourceType\":\"its/resource/type\"", 44L);
-        A.assertFile("apps/content/myapp.json", 
-                "MT4", "\"sling:resourceType\":\"its/resource/type\"", 45L);
+
+        A.assertFile("apps/myapp/components/resource/models.js", "MT1", "function someJavascriptFunction()", 42L);
+        A.assertFile("apps/myapp/components/resource/text.html", "MT2", "This is an html file", 43L);
+        A.assertFile("apps/myapp.json", "MT3", "\"sling:resourceType\":\"its/resource/type\"", 44L);
+        A.assertFile("apps/content/myapp.json", "MT4", "\"sling:resourceType\":\"its/resource/type\"", 45L);
     }
-    
+
     @Test
     public void autoMimetype() throws Exception {
         getBuilder(testRootPath)
-            .file("models.js", getClass().getResourceAsStream("/files/models.js"), null, 42)
-            .commit()
-            ;
-        A.assertFile("models.js", 
-                "application/javascript", "function someJavascriptFunction()", 42L);
+                .file("models.js", getClass().getResourceAsStream("/files/models.js"), null, 42)
+                .commit();
+        A.assertFile("models.js", "application/javascript", "function someJavascriptFunction()", 42L);
     }
-    
+
     @Test
     public void autoLastModified() throws Exception {
         getBuilder(testRootPath)
-            .file("models.js", getClass().getResourceAsStream("/files/models.js"), "MT1", -1)
-            .commit()
-            ;
-        A.assertFile("models.js", 
-                "MT1", "function someJavascriptFunction()", lastModified);
+                .file("models.js", getClass().getResourceAsStream("/files/models.js"), "MT1", -1)
+                .commit();
+        A.assertFile("models.js", "MT1", "function someJavascriptFunction()", lastModified);
     }
-    
+
     @Test
     public void autoEverything() throws Exception {
         getBuilder(testRootPath)
-            .file("a/b/c/models.js", getClass().getResourceAsStream("/files/models.js"))
-            .commit()
-            ;
-        A.assertFile("a/b/c/models.js", 
-                "application/javascript", "function someJavascriptFunction()", lastModified);
+                .file("a/b/c/models.js", getClass().getResourceAsStream("/files/models.js"))
+                .commit();
+        A.assertFile("a/b/c/models.js", "application/javascript", "function someJavascriptFunction()", lastModified);
     }
-    
-    @Test(expected=IllegalStateException.class)
+
+    @Test(expected = IllegalStateException.class)
     public void duplicatedFileFails() throws Exception {
         getBuilder(testRootPath)
-            .siblingsMode()
-            .file("models.js", getClass().getResourceAsStream("/files/models.js"), null, 42)
-            .file("models.js", getClass().getResourceAsStream("/files/models.js"), null, 42)
-            ;
+                .siblingsMode()
+                .file("models.js", getClass().getResourceAsStream("/files/models.js"), null, 42)
+                .file("models.js", getClass().getResourceAsStream("/files/models.js"), null, 42);
     }
-    
-    @Test(expected=IllegalArgumentException.class)
+
+    @Test(expected = IllegalArgumentException.class)
     public void nullDataFails() throws Exception {
-        getBuilder(testRootPath)
-            .file("models.js", null, null, 42)
-            ;
+        getBuilder(testRootPath).file("models.js", null, null, 42);
     }
-    
+
     @Test
     public void forParent() throws PersistenceException {
         new ResourceBuilderFactoryService()
-            .forParent(getTestRoot(testRootPath))
-            .resource("a/b/c")
-            .commit();
+                .forParent(getTestRoot(testRootPath))
+                .resource("a/b/c")
+                .commit();
         A.assertResource("a/b/c");
     }
-    
+
     @Test
     public void forResolver() throws PersistenceException {
         new ResourceBuilderFactoryService()
-            .forResolver(resourceResolver)
-            .resource("d/e/f")
-            .commit();
-        
+                .forResolver(resourceResolver)
+                .resource("d/e/f")
+                .commit();
+
         // Resource is created at root in this case
         A.assertResource("/d/e/f");
     }
@@ -352,13 +330,13 @@ public class ResourceBuilderImplTest {
     @Test
     public void absolutePath() throws Exception {
         new ResourceBuilderFactoryService()
-            .forResolver(resourceResolver)
-            .resource("/a/b/c")
-            .resource("/a/b/f")
-            .resource("/g/h/i")
-            .resource("j/l/m")
-            .resource("/o/p/q");
-        
+                .forResolver(resourceResolver)
+                .resource("/a/b/c")
+                .resource("/a/b/f")
+                .resource("/g/h/i")
+                .resource("j/l/m")
+                .resource("/o/p/q");
+
         // absolute paths are supported and can be mixed with relative paths
         A.assertResource("/a/b/c");
         A.assertResource("/a/b/f");
@@ -370,11 +348,19 @@ public class ResourceBuilderImplTest {
     @Test
     public void absolutePathSwitchBackToSiblingMode() throws Exception {
         new ResourceBuilderFactoryService()
-            .forResolver(resourceResolver)
-            .resource("/a").siblingsMode().resource("a1").resource("a2")
-            .resource("/b").siblingsMode().resource("b1").resource("b2")
-            .resource("/c").resource("c1").resource("c11");
-        
+                .forResolver(resourceResolver)
+                .resource("/a")
+                .siblingsMode()
+                .resource("a1")
+                .resource("a2")
+                .resource("/b")
+                .siblingsMode()
+                .resource("b1")
+                .resource("b2")
+                .resource("/c")
+                .resource("c1")
+                .resource("c11");
+
         // make sure sibling mode is switched back to hierarchy mode when absolute resources is used
         A.assertResource("/a");
         A.assertResource("/a/a1");
@@ -394,10 +380,7 @@ public class ResourceBuilderImplTest {
                 .resource("/content");
         content.resource("a");
         content.resource("b/c");
-        content.resource("/test")
-                .siblingsMode()
-                .resource("1")
-                .resource("2");
+        content.resource("/test").siblingsMode().resource("1").resource("2");
 
         A.assertResource("/content/a");
         A.assertResource("/content/b/c");
@@ -405,5 +388,4 @@ public class ResourceBuilderImplTest {
         A.assertResource("/test/1");
         A.assertResource("/test/2");
     }
-
 }
diff --git a/src/test/java/org/apache/sling/resourcebuilder/it/FileRetrievalIT.java b/src/test/java/org/apache/sling/resourcebuilder/it/FileRetrievalIT.java
index eb25855..325290e 100644
--- a/src/test/java/org/apache/sling/resourcebuilder/it/FileRetrievalIT.java
+++ b/src/test/java/org/apache/sling/resourcebuilder/it/FileRetrievalIT.java
@@ -18,6 +18,9 @@
  */
 package org.apache.sling.resourcebuilder.it;
 
+import java.io.IOException;
+import java.io.InputStream;
+
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.PersistenceException;
 import org.apache.sling.api.resource.Resource;
@@ -33,9 +36,6 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
-import java.io.IOException;
-import java.io.InputStream;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -43,7 +43,7 @@ import static org.ops4j.pax.exam.CoreOptions.options;
 
 /** Verify that our file structure is correct,
  *  by creating a file and retrieving it via
- *  a Sling request. 
+ *  a Sling request.
  */
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
@@ -56,7 +56,7 @@ public class FileRetrievalIT extends ResourceBuilderTestSupport {
         initializeTestResources();
         resourceAssertions = new ResourceAssertions(parent.getPath(), resolver());
     }
-    
+
     @After
     public void cleanup() throws PersistenceException, LoginException {
         cleanupTestResources();
@@ -64,24 +64,21 @@ public class FileRetrievalIT extends ResourceBuilderTestSupport {
 
     @Configuration
     public Option[] configuration() {
-        return options(
-                baseConfiguration()
-        );
+        return options(baseConfiguration());
     }
-    
+
     @Test
     public void createAndRetrieveFile() throws IOException {
         final String expected = "yes, it worked";
         final long startTime = System.currentTimeMillis();
         final String mimeType = "application/javascript";
-        
-        builder
-            .resource("somefolder")
-            .file("the-model.js", getClass().getResourceAsStream("/files/models.js"))
-            .commit();
-        
+
+        builder.resource("somefolder")
+                .file("the-model.js", getClass().getResourceAsStream("/files/models.js"))
+                .commit();
+
         final Resource r = resourceAssertions.assertFile("somefolder/the-model.js", mimeType, expected, -1L);
-        
+
         final ResourceMetadata meta = r.getResourceMetadata();
         assertTrue("Expecting a last modified time >= startTime", meta.getModificationTime() >= startTime);
         assertEquals("Expecting the correct mime-type", mimeType, meta.getContentType());
@@ -95,4 +92,4 @@ public class FileRetrievalIT extends ResourceBuilderTestSupport {
             is.close();
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/sling/resourcebuilder/it/ResourceBuilderIT.java b/src/test/java/org/apache/sling/resourcebuilder/it/ResourceBuilderIT.java
index 2f1dc9c..ae3ab3c 100644
--- a/src/test/java/org/apache/sling/resourcebuilder/it/ResourceBuilderIT.java
+++ b/src/test/java/org/apache/sling/resourcebuilder/it/ResourceBuilderIT.java
@@ -18,6 +18,9 @@
  */
 package org.apache.sling.resourcebuilder.it;
 
+import java.io.IOException;
+import java.util.Comparator;
+
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.PersistenceException;
 import org.apache.sling.resourcebuilder.test.ResourceAssertions;
@@ -31,13 +34,10 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
-import java.io.IOException;
-import java.util.Comparator;
-
 import static org.junit.Assert.fail;
 import static org.ops4j.pax.exam.CoreOptions.options;
 
-/** Server-side integration test for the 
+/** Server-side integration test for the
  *  ResourceBuilder, acquired via the ResourceBuilderProvider
  */
 @RunWith(PaxExam.class)
@@ -51,7 +51,7 @@ public class ResourceBuilderIT extends ResourceBuilderTestSupport {
         initializeTestResources();
         resourceAssertions = new ResourceAssertions(parent.getPath(), resolver());
     }
-    
+
     @After
     public void cleanup() throws PersistenceException, LoginException {
         cleanupTestResources();
@@ -59,9 +59,7 @@ public class ResourceBuilderIT extends ResourceBuilderTestSupport {
 
     @Configuration
     public Option[] configuration() {
-        return options(
-                baseConfiguration()
-        );
+        return options(baseConfiguration());
     }
 
     @Test
@@ -70,36 +68,35 @@ public class ResourceBuilderIT extends ResourceBuilderTestSupport {
 
         resourceAssertions.assertProperties("foo", "title", testRootPath);
     }
-    
+
     @Test
     public void smallTreeWithFile() throws IOException {
-        builder
-            .resource("somefolder")
-            .file("the-model.js", getClass().getResourceAsStream("/files/models.js"), "foo", 42L)
-            .commit();
+        builder.resource("somefolder")
+                .file("the-model.js", getClass().getResourceAsStream("/files/models.js"), "foo", 42L)
+                .commit();
 
         resourceAssertions.assertFile("somefolder/the-model.js", "foo", "yes, it worked", 42L);
     }
-    
+
     @Test
     public void fileAutoValues() throws IOException {
         final long startTime = System.currentTimeMillis();
-        builder
-            .resource("a/b/c")
-            .file("model2.js", getClass().getResourceAsStream("/files/models.js"))
-            .commit();
-        
+        builder.resource("a/b/c")
+                .file("model2.js", getClass().getResourceAsStream("/files/models.js"))
+                .commit();
+
         final Comparator<Long> moreThanStartTime = (expected, fromResource) -> {
-            if(fromResource >= startTime) {
+            if (fromResource >= startTime) {
                 return 0;
             }
             fail("last-modified is not >= than current time:" + fromResource + " < " + startTime);
             return -1;
         };
 
-        resourceAssertions.assertFile("a/b/c/model2.js", "application/javascript", "yes, it worked", startTime, moreThanStartTime);
+        resourceAssertions.assertFile(
+                "a/b/c/model2.js", "application/javascript", "yes, it worked", startTime, moreThanStartTime);
     }
-    
+
     @Test
     public void usingResolver() throws LoginException {
         builderService.forResolver(resolver()).resource("foo/a/b").commit();
@@ -108,5 +105,4 @@ public class ResourceBuilderIT extends ResourceBuilderTestSupport {
         resourceAssertions.assertResource("/foo/a/b");
         resourceAssertions.assertResource("/foo/c/d");
     }
-    
 }
diff --git a/src/test/java/org/apache/sling/resourcebuilder/it/ResourceBuilderTestSupport.java b/src/test/java/org/apache/sling/resourcebuilder/it/ResourceBuilderTestSupport.java
index 06de737..923af06 100644
--- a/src/test/java/org/apache/sling/resourcebuilder/it/ResourceBuilderTestSupport.java
+++ b/src/test/java/org/apache/sling/resourcebuilder/it/ResourceBuilderTestSupport.java
@@ -18,6 +18,11 @@
  */
 package org.apache.sling.resourcebuilder.it;
 
+import javax.inject.Inject;
+
+import java.util.Objects;
+import java.util.UUID;
+
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.PersistenceException;
 import org.apache.sling.api.resource.Resource;
@@ -31,10 +36,6 @@ import org.ops4j.pax.exam.options.ModifiableCompositeOption;
 import org.ops4j.pax.exam.options.OptionalCompositeOption;
 import org.ops4j.pax.exam.options.extra.VMOption;
 
-import javax.inject.Inject;
-import java.util.Objects;
-import java.util.UUID;
-
 import static org.apache.sling.testing.paxexam.SlingOptions.awaitility;
 import static org.apache.sling.testing.paxexam.SlingOptions.logback;
 import static org.apache.sling.testing.paxexam.SlingOptions.slingQuickstartOakTar;
@@ -58,20 +59,18 @@ public class ResourceBuilderTestSupport extends TestSupport {
 
     public ModifiableCompositeOption baseConfiguration() {
         return composite(
-            super.baseConfiguration(),
-            slingQuickstart(),
-            //Sling ResourceBuilder
-            testBundle("bundle.filename"),
-            logback(),
-            awaitility(),
-            junitBundles(),
-            newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
-                    .put("whitelist.bundles.regexp", "PAXEXAM-PROBE-.*")
-                    .asOption(),
-
-            optionalRemoteDebug(),
-            jacoco()
-        );
+                super.baseConfiguration(),
+                slingQuickstart(),
+                // Sling ResourceBuilder
+                testBundle("bundle.filename"),
+                logback(),
+                awaitility(),
+                junitBundles(),
+                newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
+                        .put("whitelist.bundles.regexp", "PAXEXAM-PROBE-.*")
+                        .asOption(),
+                optionalRemoteDebug(),
+                jacoco());
     }
 
     protected Option slingQuickstart() {
@@ -96,7 +95,8 @@ public class ResourceBuilderTestSupport extends TestSupport {
     // remove with Testing PaxExam 4.0
     protected OptionalCompositeOption jacoco() {
         final String jacocoCommand = System.getProperty("jacoco.command");
-        final VMOption option = Objects.nonNull(jacocoCommand) && !jacocoCommand.trim().isEmpty() ? vmOption(jacocoCommand) : null;
+        final VMOption option =
+                Objects.nonNull(jacocoCommand) && !jacocoCommand.trim().isEmpty() ? vmOption(jacocoCommand) : null;
         return when(Objects.nonNull(option)).useOptions(option);
     }
 
@@ -113,7 +113,7 @@ public class ResourceBuilderTestSupport extends TestSupport {
     }
 
     void cleanupTestResources() throws PersistenceException, LoginException {
-        if(resolver() != null && parent != null) {
+        if (resolver() != null && parent != null) {
             resolver().delete(parent);
             resolver().commit();
         }
diff --git a/src/test/java/org/apache/sling/resourcebuilder/test/ResourceAssertions.java b/src/test/java/org/apache/sling/resourcebuilder/test/ResourceAssertions.java
index 5e522f2..6b6d1f5 100644
--- a/src/test/java/org/apache/sling/resourcebuilder/test/ResourceAssertions.java
+++ b/src/test/java/org/apache/sling/resourcebuilder/test/ResourceAssertions.java
@@ -18,10 +18,6 @@
  */
 package org.apache.sling.resourcebuilder.test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -36,39 +32,44 @@ import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.resourcebuilder.impl.MapArgsConverter;
 import org.apache.sling.resourcebuilder.impl.ResourceBuilderImpl;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 /** Utilities for asserting Resources and their properties */
 @SuppressWarnings("null")
 public class ResourceAssertions {
-    
+
     private final ResourceResolver resourceResolver;
     private final String testRootPath;
-    
+
     public ResourceAssertions(String testRootPath, ResourceResolver r) {
         this.testRootPath = testRootPath;
         this.resourceResolver = r;
     }
-    
+
     public String fullPath(String path) {
         return path.startsWith("/") ? path : testRootPath + "/" + path;
     }
-    
+
     public Resource assertResource(String path) {
         final Resource result = resourceResolver.getResource(fullPath(path));
         assertNotNull("Expecting resource to exist:" + path, result);
         return result;
     }
-    
+
     /** Assert that a file exists and verify its properties. */
-    public Resource assertFile(String path, String mimeType, String expectedContent, Long lastModified) throws IOException {
+    public Resource assertFile(String path, String mimeType, String expectedContent, Long lastModified)
+            throws IOException {
         final Comparator<Long> defaultComparator = (expected, fromResource) -> {
-            if(expected == -1) {
+            if (expected == -1) {
                 return 0;
             }
             return expected.compareTo(fromResource);
         };
         return assertFile(path, mimeType, expectedContent, lastModified, defaultComparator);
     }
-    
+
     public String readFully(InputStream is) throws IOException {
         final ByteArrayOutputStream bos = new ByteArrayOutputStream();
         try {
@@ -79,56 +80,68 @@ public class ResourceAssertions {
             is.close();
         }
     }
-    
+
     /** Assert that a file exists and verify its properties. */
-    public Resource assertFile(String path, String mimeType, String expectedContent, Long lastModified, Comparator<Long> lastModifiedComparator) throws IOException {
+    public Resource assertFile(
+            String path,
+            String mimeType,
+            String expectedContent,
+            Long lastModified,
+            Comparator<Long> lastModifiedComparator)
+            throws IOException {
         final Resource r = assertResource(path);
         assertNotNull("Expecting resource to exist:" + path, r);
-        
+
         // Files are stored according to the standard JCR structure
         final ValueMap fileVm = r.adaptTo(ValueMap.class);
         assertNotNull("Expecting ValueMap for " + r.getPath(), fileVm);
-        assertEquals("Expecting an nt:file at " + r.getPath(), 
-                ResourceBuilderImpl.NT_FILE, fileVm.get(ResourceBuilderImpl.JCR_PRIMARYTYPE));
+        assertEquals(
+                "Expecting an nt:file at " + r.getPath(),
+                ResourceBuilderImpl.NT_FILE,
+                fileVm.get(ResourceBuilderImpl.JCR_PRIMARYTYPE));
         final Resource jcrContent = r.getChild(ResourceBuilderImpl.JCR_CONTENT);
         assertNotNull("Expecting subresource:" + ResourceBuilderImpl.JCR_CONTENT, jcrContent);
         final ValueMap vm = jcrContent.adaptTo(ValueMap.class);
         assertNotNull("Expecting ValueMap for " + jcrContent.getPath(), vm);
-        assertEquals("Expecting nt:Resource type for " + jcrContent.getPath(), 
-                ResourceBuilderImpl.NT_RESOURCE, vm.get(ResourceBuilderImpl.JCR_PRIMARYTYPE));
+        assertEquals(
+                "Expecting nt:Resource type for " + jcrContent.getPath(),
+                ResourceBuilderImpl.NT_RESOURCE,
+                vm.get(ResourceBuilderImpl.JCR_PRIMARYTYPE));
         assertEquals("Expecting the correct mime-type", mimeType, vm.get(ResourceBuilderImpl.JCR_MIMETYPE));
-        assertEquals("Expecting the correct last modified", 
-                0, lastModifiedComparator.compare(lastModified, getLastModified(vm)));
-        
+        assertEquals(
+                "Expecting the correct last modified",
+                0,
+                lastModifiedComparator.compare(lastModified, getLastModified(vm)));
+
         final InputStream is = vm.get(ResourceBuilderImpl.JCR_DATA, InputStream.class);
         assertNotNull("Expecting InputStream property on nt:resource:" + ResourceBuilderImpl.JCR_DATA, is);
         final String content = readFully(is);
         assertTrue("Expecting content to contain " + expectedContent, content.contains(expectedContent));
-        
+
         return r;
     }
-    
+
     private Long getLastModified(ValueMap vm) {
         final Object o = vm.get(ResourceBuilderImpl.JCR_LASTMODIFIED);
-        if(o instanceof Long) {
-            return (Long)o;
-        } else if(o instanceof Calendar) {
-            return ((Calendar)o).getTimeInMillis();
+        if (o instanceof Long) {
+            return (Long) o;
+        } else if (o instanceof Calendar) {
+            return ((Calendar) o).getTimeInMillis();
         }
         throw new IllegalArgumentException("Unexpected type " + o.getClass().getName());
     }
-    
-    public void assertProperties(String path, Object ...props) {
+
+    public void assertProperties(String path, Object... props) {
         final Map<String, Object> expected = MapArgsConverter.toMap(props);
         final Resource r = assertResource(path);
         final ValueMap vm = r.adaptTo(ValueMap.class);
-        for(Map.Entry<String, Object> e : expected.entrySet()) {
+        for (Map.Entry<String, Object> e : expected.entrySet()) {
             final Object value = vm.get(e.getKey());
             assertNotNull("Expecting property " + e.getKey() + " for resource " + r.getPath());
             assertEquals(
-                    "Expecting value " + e.getValue() 
-                    + " for property " + e.getKey() + " of resource " + r.getPath()
-                    , e.getValue(), value);
+                    "Expecting value " + e.getValue() + " for property " + e.getKey() + " of resource " + r.getPath(),
+                    e.getValue(),
+                    value);
         }
     }
-}
\ No newline at end of file
+}