@Test
  public void testNegativeLowerBound() {
    DynamicQuery dynamicQuery = ClassNameLocalServiceUtil.dynamicQuery();

    dynamicQuery.addOrder(OrderFactoryUtil.asc("classNameId"));
    dynamicQuery.setLimit(-50, _allClassNames.size());

    Assert.assertEquals(
        _allClassNames, ClassNameLocalServiceUtil.<ClassName>dynamicQuery(dynamicQuery));
  }
  @Test
  public void testStartHigherThanEnd() {
    DynamicQuery dynamicQuery = ClassNameLocalServiceUtil.dynamicQuery();

    dynamicQuery.setLimit(1984, 309);

    List<ClassName> dynamicQueryClassNames = ClassNameLocalServiceUtil.dynamicQuery(dynamicQuery);

    Assert.assertTrue(dynamicQueryClassNames.isEmpty());
  }
  @Test
  public void testNegativeBoundaries() {
    DynamicQuery dynamicQuery = ClassNameLocalServiceUtil.dynamicQuery();

    dynamicQuery.setLimit(-1985, -625);

    List<ClassName> dynamicQueryClassNames = ClassNameLocalServiceUtil.dynamicQuery(dynamicQuery);

    Assert.assertTrue(dynamicQueryClassNames.isEmpty());
  }
  @Test
  public void testNoResults() {
    DynamicQuery dynamicQuery = ClassNameLocalServiceUtil.dynamicQuery();

    dynamicQuery.setLimit(10, 10);

    List<ClassName> dynamicQueryClassNames = ClassNameLocalServiceUtil.dynamicQuery(dynamicQuery);

    Assert.assertTrue(dynamicQueryClassNames.isEmpty());
  }
  @Test
  public void testNegativeUpperBound() {
    DynamicQuery dynamicQuery = ClassNameLocalServiceUtil.dynamicQuery();

    dynamicQuery.setLimit(QueryUtil.ALL_POS, -50);

    List<ClassName> dynamicQueryClassNames = ClassNameLocalServiceUtil.dynamicQuery(dynamicQuery);

    Assert.assertTrue(dynamicQueryClassNames.isEmpty());
  }
  @Test
  public void testUpperBound() {
    DynamicQuery dynamicQuery = ClassNameLocalServiceUtil.dynamicQuery();

    dynamicQuery.addOrder(OrderFactoryUtil.asc("classNameId"));
    dynamicQuery.setLimit(QueryUtil.ALL_POS, 10);

    Assert.assertEquals(
        _allClassNames.subList(0, 10),
        ClassNameLocalServiceUtil.<ClassName>dynamicQuery(dynamicQuery));
  }
  @Test
  public void testSingleResult() {
    DynamicQuery dynamicQuery = ClassNameLocalServiceUtil.dynamicQuery();

    dynamicQuery.addOrder(OrderFactoryUtil.asc("classNameId"));
    dynamicQuery.setLimit(10, 11);

    List<ClassName> dynamicQueryClassNames = ClassNameLocalServiceUtil.dynamicQuery(dynamicQuery);

    Assert.assertEquals(1, dynamicQueryClassNames.size());
    Assert.assertEquals(_allClassNames.get(10), dynamicQueryClassNames.get(0));
  }
  @Test
  public void testNoLimit() {
    DynamicQuery dynamicQuery = ClassNameLocalServiceUtil.dynamicQuery();

    dynamicQuery.addOrder(OrderFactoryUtil.asc("classNameId"));

    List<ClassName> classNames = ClassNameLocalServiceUtil.dynamicQuery(dynamicQuery);

    for (ClassName className : _allClassNames) {
      if (!classNames.contains(className)) {
        Assert.fail("Class names do not contain " + className);
      }
    }
  }
  @Test
  public void testCriterion() {
    DynamicQuery dynamicQuery = ClassNameLocalServiceUtil.dynamicQuery();

    Property classNameIdProperty = PropertyFactoryUtil.forName("classNameId");

    ClassName className = _allClassNames.get(10);

    dynamicQuery.add(classNameIdProperty.eq(className.getClassNameId()));

    List<ClassName> classNames = ClassNameLocalServiceUtil.dynamicQuery(dynamicQuery);

    Assert.assertEquals(1, classNames.size());
    Assert.assertEquals(className, classNames.get(0));
  }
  @Test
  public void testOrderBy() {
    DynamicQuery dynamicQuery = ClassNameLocalServiceUtil.dynamicQuery();

    Property classNameIdProperty = PropertyFactoryUtil.forName("classNameId");

    ClassName lastClassName = _allClassNames.get(_allClassNames.size() - 1);

    dynamicQuery.add(classNameIdProperty.le(lastClassName.getClassNameId()));

    dynamicQuery.addOrder(OrderFactoryUtil.desc("classNameId"));

    _allClassNames = new ArrayList<>(_allClassNames);

    Collections.reverse(_allClassNames);

    Assert.assertEquals(
        _allClassNames, ClassNameLocalServiceUtil.<ClassName>dynamicQuery(dynamicQuery));
  }