add tests for @Trace
remove duplicated code