To avoid the case when it absent we can re-write it as below

    public final void retrievesSingleKey() throws Exception {
        final PublicKeys keys = this.keys();
        final PublicKey key = keys.create("Title", "Key");
        MatcherAssert.assertThat(
            keys.get(key.number()),
            Matchers.equalTo(key)
        );
    }