Skip to content

Commit

Permalink
Fix #496
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Sep 23, 2014
1 parent 7b0913f commit ddde8e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,13 @@ public String asText(String defaultValue) {
@Override
public boolean asBoolean(boolean defaultValue) {
if (_value != null) {
if ("true".equals(_value.trim())) {
String v = _value.trim();
if ("true".equals(v)) {
return true;
}
if ("false".equals(v)) {
return false;
}
}
return defaultValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public void testText()

assertEquals("foobar", n.asText("barf"));
assertEquals("", empty.asText("xyz"));

assertTrue(TextNode.valueOf("true").asBoolean(true));
assertTrue(TextNode.valueOf("true").asBoolean(false));
assertFalse(TextNode.valueOf("false").asBoolean(true));
assertFalse(TextNode.valueOf("false").asBoolean(false));
}

public void testBoolean()
Expand Down

0 comments on commit ddde8e3

Please sign in to comment.