Package org.springframework.data.mongodb.core

Examples of org.springframework.data.mongodb.core.Person


  @Test
  public void handlesAllPropertiesIfDBObject() {

    DBObject query = new BasicDBObject();
    query.put("foo", new BasicDBObject("$in", Arrays.asList(1, 2)));
    query.put("bar", new Person());

    DBObject result = mapper.getMappedObject(query, null);
    assertThat(result.get("bar"), is(notNullValue()));
  }
View Full Code Here


   * @see DATAMONGO-469
   */
  @Test
  public void createsAndQueryCorrectly() {

    Person person = new Person();
    MongoQueryCreator creator = new MongoQueryCreator(new PartTree("findByFirstNameAndFriend", Person.class),
        getAccessor(converter, "Oliver", person), context);
    Query query = creator.createQuery();

    assertThat(query, is(query(where("firstName").is("Oliver").and("friend").is(person))));
View Full Code Here

  @SuppressWarnings("unchecked")
  @Test
  public void testDeleteExecutionLoadsListOfRemovedDocumentsWhenReturnTypeIsCollectionLike() {

    when(this.mongoOperationsMock.find(Matchers.any(Query.class), Matchers.any(Class.class), Matchers.anyString()))
        .thenReturn(Arrays.asList(new Person(new ObjectId(new Date()), "bar")));

    createQueryForMethod("deleteByLastname", String.class).setDeleteQuery(true).execute(new Object[] { "booh" });

    verify(this.mongoOperationsMock, times(1)).findAllAndRemove(Matchers.any(Query.class), Matchers.eq(Person.class),
        Matchers.eq("persons"));
View Full Code Here

   * @see DATAMONGO-1080
   */
  @Test
  public void doesNotTryToPostProcessQueryResultIntoWrapperType() {

    Person reference = new Person();
    when(mongoOperationsMock.findOne(Mockito.any(Query.class), eq(Person.class), eq("persons"))).//
        thenReturn(reference);

    AbstractMongoQuery query = createQueryForMethod("findByLastname", String.class);

View Full Code Here

   * @see DATAMONGO-840
   */
  @Test
  public void shouldRenderCompoundExpressionsWithIndexerAndFieldReference() {

    Person person = new Person();
    person.setAge(10);
    assertThat(transform("[0].age + a.c", person), is("{ \"$add\" : [ 10 , \"$a.c\"]}"));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.mongodb.core.Person

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.