Assert that methods are called on main thread when necessary