Fix and test GroupBy SQL query creation

Signed-off-by: Ian Southam <isoutham@schubergphilis.com>
findbugs findings fixed
String str.method changed to str = String str.method
Strings are immutable
Added unit test
Added some final assignments in line with coding standards
Java reult sets are indexed from 1
resultsets are indexed from 1 not 0
Revert "resultsets are indexed from 1 not 0"

This reverts commit d1ae34af0e3cabc90b34e039385386a4778c3651.
Resultssets are indexed from 1 not 0
findbugs findings