refactored castings in source extraction code of JestResult
added test for CountResult