@Test
  public void unitOfWorkEvenWhenQuerying() {
    try (IDocumentStore store = new DocumentStore(getDefaultUrl(), getDefaultDb()).initialize()) {
      try (IDocumentSession session = store.openSession()) {

        Post post = new Post();
        post.setTitle("test");
        post.setBody("casing");
        session.store(post);
        session.saveChanges();

        Post single =
            session.advanced().documentQuery(Post.class).waitForNonStaleResults().single();

        assertSame(post, single);
      }
    }
  }
  @Test
  public void canQueryByEntityType() {
    try (IDocumentStore store = new DocumentStore(getDefaultUrl(), getDefaultDb()).initialize()) {
      try (IDocumentSession session = store.openSession()) {

        Post post = new Post();
        post.setTitle("test");
        post.setBody("casing");
        session.store(post);
        session.saveChanges();

        Post single =
            session.advanced().documentQuery(Post.class).waitForNonStaleResults().single();

        assertEquals("test", single.getTitle());
      }
    }
  }