Refactor method substitute-childopts to use cond and cleaner asserts in unit tests