add castAll method
refactoring unit tests