Improve reading of json from Gerrit API

The PR improves the way Gerrit API result json is queried so that
the test is more robust.

In addition, a potentially failing and unneccessary "open()" call
was removed.

Lastly, the use of ProcessBuilder was re-worked to improve debugging
for failed command executions.