Self testing quantum apparatus