diff --git a/htmlSanityCheck-cli/src/main/groovy/org/aim42/htmlsanitycheck/cli/HscCommand.groovy b/htmlSanityCheck-cli/src/main/groovy/org/aim42/htmlsanitycheck/cli/HscCommand.groovy
index 2b94de28..adbe336f 100644
--- a/htmlSanityCheck-cli/src/main/groovy/org/aim42/htmlsanitycheck/cli/HscCommand.groovy
+++ b/htmlSanityCheck-cli/src/main/groovy/org/aim42/htmlsanitycheck/cli/HscCommand.groovy
@@ -51,8 +51,8 @@ class HscCommand implements Runnable {
}
static {
- LogManager logManager = LogManager.getLogManager();
- logManager.reset();
+ LogManager logManager = LogManager.getLogManager()
+ logManager.reset()
rootLogger = Logger.getLogger("org.aim42.htmlsanitycheck")
logger = Logger.getLogger(HscCommand.class.name)
@@ -72,7 +72,7 @@ class HscCommand implements Runnable {
}
@Option(names = ["-v", "--verbose"],
- description = "Increase verbosity. Repeatable, cumulative -v -vv -vvv",
+ description = "Increase verbosity. Repeatable, cumulative, i.e., -v, -vv, -vvv, or -vvvv",
fallbackValue = "true", arity = "0..3")
private boolean[] verbosity
diff --git a/htmlSanityCheck-cli/src/test/groovy/org/aim42/htmlsanitycheck/cli/HscCommandSpec.groovy b/htmlSanityCheck-cli/src/test/groovy/org/aim42/htmlsanitycheck/cli/HscCommandSpec.groovy
index 3e731a51..cb01976f 100644
--- a/htmlSanityCheck-cli/src/test/groovy/org/aim42/htmlsanitycheck/cli/HscCommandSpec.groovy
+++ b/htmlSanityCheck-cli/src/test/groovy/org/aim42/htmlsanitycheck/cli/HscCommandSpec.groovy
@@ -73,17 +73,23 @@ class HscCommandSpec extends Specification {
errContent.toString().contains("Check HTML files for Sanity")
}
- def "test with empty source directory"() {
+ @Unroll
+ // For misc. log levels
+ def "test with empty source directory and verbosity #args"() {
given:
TemporaryFolder testProjectDir = new TemporaryFolder()
testProjectDir.create()
SecurityManager originalSecurityManager = System.getSecurityManager()
SecurityManager mockSecurityManager = new NoExitSecurityMock(originalSecurityManager)
System.setSecurityManager(mockSecurityManager)
- String[] args = [testProjectDir.root]
+ List mainArgs = new ArrayList<>()
+ if (args) {
+ mainArgs.add(args)
+ }
+ mainArgs.add(testProjectDir.root)
when:
- HscCommand.main(args)
+ HscCommand.main(mainArgs as String[])
then:
mockSecurityManager.exitCalled == 1
@@ -92,6 +98,15 @@ class HscCommandSpec extends Specification {
cleanup:
testProjectDir.delete()
+
+ where:
+ args << [
+ "",
+ "-v",
+ "-vv",
+ "-vvv",
+ "-vvvv"
+ ]
}
def "test with valid HTML file"() {
@@ -103,7 +118,7 @@ class HscCommandSpec extends Specification {
HscCommand.main(args)
then:
- File resultFile = new File (testResultsDir.root, 'index.html')
+ File resultFile = new File(testResultsDir.root, 'index.html')
resultFile.exists()
String result = resultFile.text
result.toString().contains("")
@@ -118,7 +133,7 @@ class HscCommandSpec extends Specification {
HscCommand.main(args)
then:
- File resultFile = new File (testResultsDir.root, 'index.html')
+ File resultFile = new File(testResultsDir.root, 'index.html')
resultFile.exists()
String result = resultFile.text
result.toString().contains("\n")