Hi,
say we have an array like this
def my_array = [ [45.26], [44.6],[47.25] ]
def expected = 50 as Float
how do you validate that each element are less than 50
i tried this:
assert my_array .every {it < expected }
It throws:
groovy.lang.GroovyRuntimeException: Cannot compare java.util.ArrayList with value '[45.26]' and java.lang.Float with value '50' error at line: ...
It's comparing this value [45.26] instead of this 45.26
i tried this:
assert my_array.max() < expected
Solved! Go to Solution.
Found solution with:
log.info my_array.sum().max()
which returns the max of all array then i have to compare.
please close this thread.
User | Count |
---|---|
6 | |
6 | |
4 | |
2 | |
1 |
Subject | Author | Latest Post |
---|---|---|