Skip to content

Commit f5c3682

Browse files
committed
Explicit test and result.
1 parent 12f3d60 commit f5c3682

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

src/main/java/com/hubspot/jinjava/interpret/NullValue.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
public final class NullValue {
99
public static final NullValue INSTANCE = new NullValue();
1010

11-
static NullValue instance() {
11+
private NullValue() {}
12+
13+
public static NullValue instance() {
1214
return INSTANCE;
1315
}
1416

src/test/java/com/hubspot/jinjava/lib/tag/ForTagTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,12 +381,13 @@ public void itAllowsCheckingOfWithinForLoop() throws NoSuchMethodException {
381381
public void forLoopWithNullValues() {
382382
context.put("number", -1);
383383
context.put("the_list", Lists.newArrayList(1L, 2L, null, null, null));
384-
TagNode tagNode = (TagNode) fixture("loop-last-var");
385-
Document dom = Jsoup.parseBodyFragment(tag.interpret(tagNode, interpreter));
386-
387-
assertThat(dom.select("h3")).hasSize(4);
388-
dom.outputSettings().prettyPrint(true).indentAmount(4);
389-
assertThat(dom.html()).contains("seven: null");
384+
String template = "{% for number in the_list %} {{ number }} {% endfor %}";
385+
TagNode tagNode = (TagNode) new TreeParser(interpreter, template)
386+
.buildTree()
387+
.getChildren()
388+
.getFirst();
389+
String result = tag.interpret(tagNode, interpreter);
390+
assertThat(result).isEqualTo(" 1 2 null null null ");
390391
}
391392

392393
public static boolean inForLoop() {

0 commit comments

Comments
 (0)