Fix possible ClassCastException when reading confidence from a prediction object

Sometimes BigML returns predictions with 0 (`Long`) as confidence. This causes a `ClassCastException` in statements like:
```
this.confidence = (Double) root.get("confidence")
```
I've also fixed a misusing of `Thread.sleep(time)` where `time` is expected to be milliseconds but looks like in the code it  was set as seconds.
Finally, I modified the order of the `assertEquals` statement so the message in case of an Exception is more clear.

I'm really sorry about the bunch of differences in the patch due to formatting and trimming of trailing white spaces. I'll configure my IDE in order that it doesn't modify the lines not affected by my modifications.