bump up junit version to 4.12
replace conditional with polymorphism