Added test case to cover scenario in TemplateTest.java. Remove unnecessary methods from Visitor.java