You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:58:16 UTC

[sling-org-apache-sling-resourcebuilder] 07/36: SLING-5356 - add a few missing tests

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

rombert pushed a commit to annotated tag org.apache.sling.resourcebuilder-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourcebuilder.git

commit eeeaa78269a7262eaf07c5ac0e39f5a445244861
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Dec 11 09:08:58 2015 +0000

    SLING-5356 - add a few missing tests
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/resourcebuilder@1719289 13f79535-47bb-0310-9956-ffa450edef68
---
 .../impl/ResourceBuilderImplTest.java              | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)

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 9807507..34f2e03 100644
--- a/src/test/java/org/apache/sling/resourcebuilder/impl/ResourceBuilderImplTest.java
+++ b/src/test/java/org/apache/sling/resourcebuilder/impl/ResourceBuilderImplTest.java
@@ -307,4 +307,37 @@ public class ResourceBuilderImplTest {
         assertFile("models.js", 
                 "MT1", "function someJavascriptFunction()", lastModified);
     }
+    
+    @Test
+    public void autoEverything() throws Exception {
+        getBuilder(testRootPath)
+            .file("models.js", getClass().getResourceAsStream("/models.js"))
+            .commit()
+            ;
+        assertFile("models.js", 
+                "application/javascript", "function someJavascriptFunction()", lastModified);
+    }
+    
+    @Test(expected=IllegalStateException.class)
+    public void duplicatedFileFails() throws Exception {
+        getBuilder(testRootPath)
+            .siblingsMode()
+            .file("models.js", getClass().getResourceAsStream("/models.js"), null, 42)
+            .file("models.js", getClass().getResourceAsStream("/models.js"), null, 42)
+            ;
+    }
+    
+    @Test(expected=IllegalArgumentException.class)
+    public void fileWithPathFails() throws Exception {
+        getBuilder(testRootPath)
+            .file("somewhere/models.js", getClass().getResourceAsStream("/models.js"), null, 42)
+            ;
+    }
+    
+    @Test(expected=IllegalArgumentException.class)
+    public void nullDataFails() throws Exception {
+        getBuilder(testRootPath)
+            .file("models.js", null, null, 42)
+            ;
+    }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.