For anyone interested, here's the documentation.
public void testTrue() {
String str = "true";
boolean expected = true;
assertEquals("not what you expected?", expected, Boolean
.getBoolean(str));
}
public void testFalse() {
String str = "false";
boolean expected = false;
assertEquals("not what you expected?", expected, Boolean
.getBoolean(str));
}
isn't reading the documentation cheating? After reading the documentation does anybody else think this function is in the wrong spot?
ReplyDeleteI agree... and I think that the name sucks wrt what it actually does... It would be good if they just made another method that does that same thing and depreciate getBoolean().
ReplyDeleteYou could probably just deprecate this function, and use Boolean.parseBoolean(System.getProperty(str)).
ReplyDeleteI don't really see that you'd need to use this function all that often, and even if you did, then the solution I mentioned would be much more clear to other programmers as to what you were actually trying to accomplish.