Any help is appreciated:
I am running a simple java currency converter application and trying to test it using conditional bash statements. For this test I am seeking to test when the user doesn't enter any value into the application what the resulting output is. Here is the bash script:
#!/bin/bash
input=""
expectedOuput="Please enter correct input"
actualOutput=$(java CurrencyConverter $input)
if [ $expectedOutput == $actualOutput ]; then
echo "Test 1 Passed"
else
echo "Test 1 Failed"
fi
I am aiming for the test to fail and echo this, however the script just returns the java error instead of echoing, like this:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
at CurrencyConverter.main(CurrencyConverter.java:12)
I am newer to bash scripting so have been changing the syntax, I just cant seem to stop the java error being printed