Refatoring for unit test nico

.