Refact the unittest