From 858828441ac2135eabc06b1f27ff83212048791a Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Sat, 2 Apr 2016 17:33:52 -0400 Subject: better error messages in case of messed up groupIds, artifactIds or versions --- test/test.scala | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/test.scala') 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) -- cgit v1.2.3