Throw exception if method receives wrong dependency