Use exec instead of bash to start java

Fix passing multiple arguments
Add test for jenkins arguments and JENKINS_OPTS
diff --git a/jenkins.sh b/jenkins.sh
index d943ffc..dd28123 100755
--- a/jenkins.sh
+++ b/jenkins.sh
@@ -29,7 +29,7 @@
 
 # if `docker run` first argument start with `--` the user is passing jenkins launcher arguments
 if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then
-  exec /bin/bash -c "java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS $@"
+  exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS "$@"
 fi
 
 # As argument is not jenkins, assume user want to run his own process, for sample a `bash` shell to explore this image
diff --git a/tests/test_helpers.bash b/tests/test_helpers.bash
index 9990049..4ee7ed9 100644
--- a/tests/test_helpers.bash
+++ b/tests/test_helpers.bash
@@ -9,7 +9,7 @@
 function assert {
     local expected_output=$1
     shift
-    actual_output=$("$@")
+    local actual_output=$("$@")
     if ! [ "$actual_output" = "$expected_output" ]; then
         echo "expected: \"$expected_output\", actual: \"$actual_output\""
         false
@@ -55,3 +55,8 @@
         false
     fi
 }
+
+function cleanup {
+    docker kill $1 &>/dev/null ||:
+    docker rm -fv $1 &>/dev/null ||:
+}
diff --git a/tests/tests.bats b/tests/tests.bats
index 4504a15..1e8ec44 100644
--- a/tests/tests.bats
+++ b/tests/tests.bats
@@ -6,13 +6,28 @@
 load test_helpers
 
 @test "build image" {
-	cd $BATS_TEST_DIRNAME/..
-	docker build -t $SUT_IMAGE .
+  cd $BATS_TEST_DIRNAME/..
+  docker build -t $SUT_IMAGE .
 }
 
 @test "clean test containers" {
-    docker kill $SUT_CONTAINER &>/dev/null ||:
-    docker rm -fv $SUT_CONTAINER &>/dev/null ||:
+    cleanup $SUT_CONTAINER
+}
+
+@test "test multiple JENKINS_OPTS" {
+  # running --help --version should return the version, not the help
+  local version=$(grep 'ENV JENKINS_VERSION' Dockerfile | sed -e 's/ENV JENKINS_VERSION //')
+  # need the last line of output, removing the last char
+  local actual_version=$(docker run --rm -ti -e JENKINS_OPTS="--help --version" --name $SUT_CONTAINER -P $SUT_IMAGE | tail -n 1)
+  assert "${version}" echo ${actual_version::-1}
+}
+
+@test "test jenkins arguments" {
+  # running --help --version should return the version, not the help
+  local version=$(grep 'ENV JENKINS_VERSION' Dockerfile | sed -e 's/ENV JENKINS_VERSION //')
+  # need the last line of output, removing the last char
+  local actual_version=$(docker run --rm -ti --name $SUT_CONTAINER -P $SUT_IMAGE --help --version | tail -n 1)
+  assert "${version}" echo ${actual_version::-1}
 }
 
 @test "create test container" {
@@ -20,10 +35,14 @@
 }
 
 @test "test container is running" {
-	sleep 1  # give time to eventually fail to initialize
-	retry 3 1 assert "true" docker inspect -f {{.State.Running}} $SUT_CONTAINER
+  sleep 1  # give time to eventually fail to initialize
+  retry 3 1 assert "true" docker inspect -f {{.State.Running}} $SUT_CONTAINER
 }
 
 @test "Jenkins is initialized" {
     retry 30 5 test_url /api/json
 }
+
+@test "clean test containers" {
+    cleanup $SUT_CONTAINER
+}