extract assert_equality method