test&code state() method