Factor out test wrapper