I've encountered a bug in my codebase, I've narrowed down to what caused this behavior. The first test case fails, whereas the last two succeed.
@Test
public void testBooleanNull1() {
    Boolean nullB = null;
    assertFalse(Boolean.valueOf(nullB));
}
@Test
public void testBooleanNull2() {
    String nullS = null;
    assertFalse(Boolean.valueOf(nullS));
}
@Test
public void testBooleanNull3() {
    assertFalse(Boolean.valueOf(null));
}
I know that Boolean.valueOf is an overloaded method with two variants one takes a String and the other takes a primitive of type boolean.
I suspect that this is happening because of auto-boxing but I'm not sure if that is the case, furthermore I don't know why null is being converted to a Boolean as far as I know null is not a valid primitive type.
I've moved on to using BooleanUtils from Apache Commons, I asked this here to better understand why the behavior is this way.
 
     
     
     
     
     
    