add assert_null and assert_not_null functions

There are many attributes in spec that be initialized to null. Using
these two functions can instead of the repeatly checking statement.