Package org.springframework.data.jpa.domain

Examples of org.springframework.data.jpa.domain.JpaSort


  private static final PluralAttribute<?, ?, ?> NULL_PLURAL_ATTRIBUTE = null;
  private static final PluralAttribute<?, ?, ?>[] EMPTY_PLURAL_ATTRIBUTES = new PluralAttribute<?, ?, ?>[0];

  @Test(expected = IllegalArgumentException.class)
  public void rejectsNullAttribute() {
    new JpaSort(NULL_ATTRIBUTE);
  }
View Full Code Here


    new JpaSort(NULL_ATTRIBUTE);
  }

  @Test(expected = IllegalArgumentException.class)
  public void rejectsEmptyAttributes() {
    new JpaSort(EMPTY_ATTRIBUTES);
  }
View Full Code Here

    new JpaSort(EMPTY_ATTRIBUTES);
  }

  @Test(expected = IllegalArgumentException.class)
  public void rejectsNullPluralAttribute() {
    new JpaSort(NULL_PLURAL_ATTRIBUTE);
  }
View Full Code Here

    new JpaSort(NULL_PLURAL_ATTRIBUTE);
  }

  @Test(expected = IllegalArgumentException.class)
  public void rejectsEmptyPluralAttributes() {
    new JpaSort(EMPTY_PLURAL_ATTRIBUTES);
  }
View Full Code Here

    new JpaSort(EMPTY_PLURAL_ATTRIBUTES);
  }

  @Test
  public void sortBySinglePropertyWithDefaultSortDirection() {
    assertThat(new JpaSort(path(User_.firstname)), hasItems(new Sort.Order("firstname")));
  }
View Full Code Here

  }

  @Test
  public void sortByMultiplePropertiesWithDefaultSortDirection() {

    assertThat(new JpaSort(User_.firstname, User_.lastname),
        hasItems(new Sort.Order("firstname"), new Sort.Order("lastname")));
  }
View Full Code Here

  }

  @Test
  public void sortByMultiplePropertiesWithDescSortDirection() {

    assertThat(new JpaSort(Direction.DESC, User_.firstname, User_.lastname),
        hasItems(new Sort.Order(Direction.DESC, "firstname"), new Sort.Order(Direction.DESC, "lastname")));
  }
View Full Code Here

  }

  @Test
  public void combiningSortByMultipleProperties() {

    assertThat(new JpaSort(User_.firstname).and(new JpaSort(User_.lastname)),
        hasItems(new Sort.Order("firstname"), new Sort.Order("lastname")));
  }
View Full Code Here

  }

  @Test
  public void combiningSortByMultiplePropertiesWithDifferentSort() {

    assertThat(new JpaSort(User_.firstname).and(new JpaSort(Direction.DESC, User_.lastname)),
        hasItems(new Sort.Order("firstname"), new Sort.Order(Direction.DESC, "lastname")));
  }
View Full Code Here

  }

  @Test
  public void combiningSortByNestedEmbeddedProperty() {

    assertThat(new JpaSort(path(User_.address).dot(Address_.streetName)),
        hasItems(new Sort.Order("address.streetName")));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.jpa.domain.JpaSort

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.