refactor test cases and report msg handler to make the structure more concise