diff --git a/commons-datastore/commons-datastore-core/src/test/java/org/opencb/commons/datastore/core/QueryTest.java b/commons-datastore/commons-datastore-core/src/test/java/org/opencb/commons/datastore/core/QueryTest.java index 206aa702f..5ab45e43f 100644 --- a/commons-datastore/commons-datastore-core/src/test/java/org/opencb/commons/datastore/core/QueryTest.java +++ b/commons-datastore/commons-datastore-core/src/test/java/org/opencb/commons/datastore/core/QueryTest.java @@ -62,4 +62,10 @@ public void testValidateError2() throws Exception { thrown.expect(EnumConstantNotPresentException.class); query.validate(TestQueryParam.class); } -} \ No newline at end of file + + @Test(expected = EnumConstantNotPresentException.class) + public void testValidateWrongParam() throws Exception { + Query query = new Query(TestQueryParam.TEST_PARAM_BOOLEAN.key(), true).append("wrongParam", "1"); + query.validate(TestQueryParam.class); + } +} diff --git a/commons-lib/src/test/java/org/opencb/commons/utils/FileUtilsTest.java b/commons-lib/src/test/java/org/opencb/commons/utils/FileUtilsTest.java index 8cae2f90e..e0983cb26 100644 --- a/commons-lib/src/test/java/org/opencb/commons/utils/FileUtilsTest.java +++ b/commons-lib/src/test/java/org/opencb/commons/utils/FileUtilsTest.java @@ -50,4 +50,23 @@ public void getUserAndGroupNumeric() throws IOException { Assert.assertEquals("0", user[0]); Assert.assertEquals("0", user[1]); } -} \ No newline at end of file + + @Test(expected = IOException.class) + public void checkPathNull() throws IOException { + FileUtils.checkPath(null, false); + } + + @Test(expected = IOException.class) + public void checkPathNonExist() throws IOException { + FileUtils.checkPath(path, true); + FileUtils.checkPath(Paths.get("/tmp/nonExistentPath"), true); + } + + @Test(expected = IOException.class) + public void checkFileIsDir() throws IOException { + FileUtils.checkFile(path, true); + FileUtils.checkFile(Paths.get("/tmp/test.txt"), true); + FileUtils.checkFile(Paths.get("/tmp/test.txt"), false); + FileUtils.checkFile(Paths.get("/tmp/test.txt/"), true); + } +}