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