コード例 #1
0
  /** @see DATADOC-183 */
  @Test
  public void countsDocumentsCorrectly() {

    assertThat(template.count(new Query(), Person.class), is(0L));

    Person dave = new Person("Dave");
    Person carter = new Person("Carter");

    template.save(dave);
    template.save(carter);

    assertThat(template.count(null, Person.class), is(2L));
    assertThat(template.count(query(where("firstName").is("Carter")), Person.class), is(1L));
  }
コード例 #2
0
 /** @see DATADOC-183 */
 @Test(expected = IllegalArgumentException.class)
 public void countRejectsNullCollectionName() {
   template.count(null, (String) null);
 }
コード例 #3
0
 /** @see DATADOC-183 */
 @Test(expected = IllegalArgumentException.class)
 public void countRejectsEmptyCollectionName() {
   template.count(null, "");
 }
コード例 #4
0
 /** @see DATADOC-183 */
 @Test(expected = IllegalArgumentException.class)
 public void countRejectsNullEntityClass() {
   template.count(null, (Class<?>) null);
 }