BS-10777, add unit test and clean exception of document service