@Override
  public Map<QueryId, PersistentQueryMetadata> getPersistentQueries() {
    return Collections.unmodifiableMap(persistentQueries);
  }
@Test
  public void shouldGetPersistentQueries() {
    // Given:
    final PersistentQueryMetadata q1 = givenCreate(registry, "q1", "source",
        Optional.of("sink1"), CREATE_AS);
    final PersistentQueryMetadata q2 = givenCreate(registry, "q2", "source",
        Optional.of("sink2"), INSERT);
    final PersistentQueryMetadata q3 = givenCreate(registry, "q3", "source",
        Optional.empty(), CREATE_SOURCE);

    // When:
    final Map<QueryId, PersistentQueryMetadata> persistent = registry.getPersistentQueries();

    // Then:
    assertThat(persistent.size(), is(3));
    assertThat(persistent.get(new QueryId("q1")), is(q1));
    assertThat(persistent.get(new QueryId("q2")), is(q2));
    assertThat(persistent.get(new QueryId("q3")), is(q3));
  }