extract copied code into a separate class and initial unit tests
Authored by: rbri 2015-07-26
Parent: [r537]
Child: [r539]