Functional way of for testing multiple same logic