Refactor test of PostService