Updated KeyPolicy class with methods tests