I really expect that the two first nodes is a CssElIf and the last a CssElse. They are part of my test so if it's not the case I expect to receive a assertionError and not a ClassCastException because ClassCastException could mean there is an bug in the test itself.