Package org.springframework.data.mapping

Examples of org.springframework.data.mapping.PropertyPath


  @Test
  @SuppressWarnings("rawtypes")
  public void parsesSimplePropertyCorrectly() throws Exception {

    PropertyPath reference = PropertyPath.from("userName", Foo.class);
    assertThat(reference.hasNext(), is(false));
    assertThat(reference.toDotPath(), is("userName"));
    assertThat(reference.getOwningType(), is((TypeInformation) ClassTypeInformation.from(Foo.class)));
  }
View Full Code Here


  }

  @Test
  public void parsesPathPropertyCorrectly() throws Exception {

    PropertyPath reference = PropertyPath.from("userName", Bar.class);
    assertThat(reference.hasNext(), is(true));
    assertThat(reference.next(), is(new PropertyPath("name", FooBar.class)));
    assertThat(reference.toDotPath(), is("user.name"));
  }
View Full Code Here

  }

  @Test
  public void prefersLongerMatches() throws Exception {

    PropertyPath reference = PropertyPath.from("userName", Sample.class);
    assertThat(reference.hasNext(), is(false));
    assertThat(reference.toDotPath(), is("userName"));
  }
View Full Code Here

  }

  @Test
  public void testname() throws Exception {

    PropertyPath reference = PropertyPath.from("userName", Sample2.class);
    assertThat(reference.getSegment(), is("user"));
    assertThat(reference.hasNext(), is(true));
    assertThat(reference.next(), is(new PropertyPath("name", FooBar.class)));
  }
View Full Code Here

  }

  @Test
  public void prefersExplicitPaths() throws Exception {

    PropertyPath reference = PropertyPath.from("user_name", Sample.class);
    assertThat(reference.getSegment(), is("user"));
    assertThat(reference.hasNext(), is(true));
    assertThat(reference.next(), is(new PropertyPath("name", FooBar.class)));
  }
View Full Code Here

  }

  @Test
  public void handlesGenericsCorrectly() throws Exception {

    PropertyPath reference = PropertyPath.from("usersName", Bar.class);
    assertThat(reference.getSegment(), is("users"));
    assertThat(reference.isCollection(), is(true));
    assertThat(reference.hasNext(), is(true));
    assertThat(reference.next(), is(new PropertyPath("name", FooBar.class)));
  }
View Full Code Here

  }

  @Test
  public void handlesMapCorrectly() throws Exception {

    PropertyPath reference = PropertyPath.from("userMapName", Bar.class);
    assertThat(reference.getSegment(), is("userMap"));
    assertThat(reference.isCollection(), is(false));
    assertThat(reference.hasNext(), is(true));
    assertThat(reference.next(), is(new PropertyPath("name", FooBar.class)));
  }
View Full Code Here

  }

  @Test
  public void handlesArrayCorrectly() throws Exception {

    PropertyPath reference = PropertyPath.from("userArrayName", Bar.class);
    assertThat(reference.getSegment(), is("userArray"));
    assertThat(reference.isCollection(), is(true));
    assertThat(reference.hasNext(), is(true));
    assertThat(reference.next(), is(new PropertyPath("name", FooBar.class)));
  }
View Full Code Here

  }

  @Test
  public void findsNested() {

    PropertyPath from = PropertyPath.from("barUserName", Sample.class);

    assertThat(from, is(notNullValue()));
    assertThat(from.getLeafProperty(), is(PropertyPath.from("name", FooBar.class)));
  }
View Full Code Here

   * @see DATACMNS-45
   */
  @Test
  public void handlesEmptyUnderscoresCorrectly() {

    PropertyPath propertyPath = PropertyPath.from("_foo", Sample2.class);
    assertThat(propertyPath.getSegment(), is("_foo"));
    assertThat(propertyPath.getType(), is(typeCompatibleWith(Foo.class)));

    propertyPath = PropertyPath.from("_foo__email", Sample2.class);
    assertThat(propertyPath.toDotPath(), is("_foo._email"));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.mapping.PropertyPath

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.