refactory the unittest