created test to check if on method is called