small refactoring of getOrientation, adding small junit