Modified the test for reverse element
and added test for wasEstablishedBefore.
Designed the code according to the test provided.