Rework test to not catch exception, junit does a good job of handling unexpected exceptions itself, StringBuffer replacing, code duplication