public void testAssociateNode() {
String message = "Some error happened.";
Throwable cause = new Throwable();
SoySyntaxException sse = SoySyntaxException.createCausedWithoutMetaInfo(message, cause);
String testFileContent =
"{namespace boo}\n" +
"\n" +
"/** @param goo */\n" +
"{template name=\".foo\"}\n" +
" {$goo}\n" +
"{/template}\n";
SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(testFileContent);
PrintNode pn = (PrintNode) soyTree.getChild(0).getChild(0).getChild(0);
// Before.
assertTrue(sse.getMessage().contains(message));
assertEquals(cause, sse.getCause());
assertEquals("unknown", sse.getSourceLocation().getFilePath());
assertEquals(null, sse.getTemplateName());
SoySyntaxExceptionUtils.associateNode(sse, pn);
// After.
assertTrue(sse.getMessage().contains(message));
assertEquals(cause, sse.getCause());
assertEquals("no-path", sse.getSourceLocation().getFilePath());
assertEquals("boo.foo", sse.getTemplateName());
}