1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Use AssertionErrors in tests.

This commit is contained in:
Cedric Beust 2017-04-14 12:15:50 -07:00
parent 19dc26ac16
commit f4a5d188e7

View file

@ -46,19 +46,19 @@ class VerifyKobaltZipTest : KobaltTest() {
ins.readBytes().forEach { ins.readBytes().forEach {
// Look for carriage returns // Look for carriage returns
if (it.compareTo(13) == 0) { if (it.compareTo(13) == 0) {
throw KobaltException("kobaltw has wrong line endings") throw AssertionError("kobaltw has wrong line endings")
} }
} }
if (OperatingSystem.current().isWindows()) { if (OperatingSystem.current().isWindows()) {
warn("Can't determine if kobaltw is executable under Windows") warn("Can't determine if kobaltw is executable under Windows")
} else if (!Files.isExecutable(Paths.get("dist/kobaltw"))) { } else if (!Files.isExecutable(Paths.get("dist/kobaltw"))) {
throw KobaltException("kobaltw has invalid permissions") throw AssertionError("kobaltw has invalid permissions")
} }
foundKobaltw = true foundKobaltw = true
} else if (entry.name.endsWith(mainJarFilePath)) { } else if (entry.name.endsWith(mainJarFilePath)) {
val ins = zipFile.getInputStream(entry) val ins = zipFile.getInputStream(entry)
if (ins.available() < 20000000) { if (ins.available() < 20000000) {
throw KobaltException(mainJarFilePath + " is too small: " + mainJarFilePath) throw AssertionError(mainJarFilePath + " is too small: " + mainJarFilePath)
} }
verifyMainJarFile(ins) verifyMainJarFile(ins)
foundJar = true foundJar = true
@ -70,13 +70,13 @@ class VerifyKobaltZipTest : KobaltTest() {
entry = stream.nextEntry entry = stream.nextEntry
} }
if (!foundKobaltw) { if (!foundKobaltw) {
throw KobaltException("Couldn't find kobaltw in $zipFilePath") throw AssertionError("Couldn't find kobaltw in $zipFilePath")
} }
if (!foundJar) { if (!foundJar) {
throw KobaltException("Couldn't find jar in $zipFilePath") throw AssertionError("Couldn't find jar in $zipFilePath")
} }
if (!foundWrapperJar) { if (!foundWrapperJar) {
throw KobaltException("Couldn't find wrapper jar in $zipFilePath") throw AssertionError("Couldn't find wrapper jar in $zipFilePath")
} }
kobaltLog(1, "$zipFilePath looks correct") kobaltLog(1, "$zipFilePath looks correct")
} else { } else {