diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-04-02 17:33:52 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-04-02 17:33:52 -0400 |
commit | 858828441ac2135eabc06b1f27ff83212048791a (patch) | |
tree | 230da6579b9716c4425533019268dae2ee8c661c /test/test.scala | |
parent | e18bae3a01d3a557e750ffe6b4c62fc3a80a800f (diff) | |
download | cbt-858828441ac2135eabc06b1f27ff83212048791a.tar.gz cbt-858828441ac2135eabc06b1f27ff83212048791a.tar.bz2 cbt-858828441ac2135eabc06b1f27ff83212048791a.zip |
better error messages in case of messed up groupIds, artifactIds or versions
Diffstat (limited to 'test/test.scala')
-rw-r--r-- | test/test.scala | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/test.scala b/test/test.scala index 7261287..242b639 100644 --- a/test/test.scala +++ b/test/test.scala @@ -10,6 +10,12 @@ object Main{ var successes = 0 var failures = 0 + def assertException[T:scala.reflect.ClassTag](msg: String = "")(code: => Unit)(implicit logger: Logger) = { + try{ + code + assert(false, msg) + }catch{ case _:AssertionError => } + } def assert(condition: Boolean, msg: String = "")(implicit logger: Logger) = { scala.util.Try{ Predef.assert(condition, "["++msg++"]") @@ -82,6 +88,24 @@ object Main{ assert(cp.strings.distinct == cp.strings, "duplicates in classpath: " ++ cp.string) } + // test that messed up artifacts crash with an assertion (which should tell the user what's up) + assertException[AssertionError](){ + JavaDependency("com.jcraft", "jsch", " 0.1.53").classpath + } + assertException[AssertionError](){ + JavaDependency("com.jcraft", null, "0.1.53").classpath + } + assertException[AssertionError](){ + JavaDependency("com.jcraft", "", " 0.1.53").classpath + } + assertException[AssertionError](){ + JavaDependency("com.jcraft%", "jsch", " 0.1.53").classpath + } + assertException[AssertionError](){ + JavaDependency("", "jsch", " 0.1.53").classpath + } + + System.err.println(" DONE!") System.err.println( successes.toString ++ " succeeded, "++ failures.toString ++ " failed" ) if(failures > 0) System.exit(1) else System.exit(0) |