[expectations] Generalize expectation validation