Prove that $u \in H^1(\Omega)$ [duplicate]

The identity follows from the divergence theorem on $\Omega_i$: $$ \int_{\Omega_i} \text{div}(u) \psi \, dx = - \int_{\Omega_i} u\cdot \nabla \psi\, dx + \int_{\partial\Omega_i} u\cdot n\psi\, dx, $$ where $n$ is the outer normal to $\Omega_i$.

Now, since the support of $\psi$ is on the union, the last integral is really on $\partial\Omega_1\cap \partial\Omega_2$, but with opposite orientations depending on which domain we're on. Since both functions agree on the boundary, this means that the boundary integrals will cancel each other out and give your identity.