Package org.springframework.data.solr.core.query.Criteria

Examples of org.springframework.data.solr.core.query.Criteria.Predicate


  }

  @Test
  public void testGreaterThan() {
    Criteria criteria = new Criteria("field_1").greaterThan(100);
    Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0);
    Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey());
    Assert.assertEquals(100, ((Object[]) entry.getValue())[0]);
    Assert.assertNull(((Object[]) entry.getValue())[1]);
    Assert.assertFalse(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue());
    Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue());
  }
View Full Code Here


  }

  @Test
  public void testGreaterThanEqual() {
    Criteria criteria = new Criteria("field_1").greaterThanEqual(100);
    Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0);
    Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey());
    Assert.assertEquals(100, ((Object[]) entry.getValue())[0]);
    Assert.assertNull(((Object[]) entry.getValue())[1]);
    Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue());
    Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue());
  }
View Full Code Here

  }

  @Test
  public void testGreaterThanEqualNull() {
    Criteria criteria = new Criteria("field_1").greaterThanEqual(null);
    Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0);
    Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey());
    Assert.assertNull(((Object[]) entry.getValue())[0]);
    Assert.assertNull(((Object[]) entry.getValue())[1]);
    Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue());
    Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue());

  }
View Full Code Here

  @Test
  public void testNear() {
    Point location = new Point(48.303056, 14.290556);
    Criteria criteria = new Criteria("field_1").near(location, new Distance(5));
    Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0);
    Assert.assertEquals(OperationKey.NEAR.getKey(), entry.getKey());
    Assert.assertEquals(location, ((Object[]) entry.getValue())[0]);
    Assert.assertEquals(5, ((Distance) ((Object[]) entry.getValue())[1]).getValue(), 0);
  }
View Full Code Here

  @Test
  public void testWithin() {
    Point location = new Point(48.303056, 14.290556);
    Criteria criteria = new Criteria("field_1").within(location, new Distance(5));
    Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0);
    Assert.assertEquals(OperationKey.WITHIN.getKey(), entry.getKey());
    Assert.assertEquals(location, ((Object[]) entry.getValue())[0]);
    Assert.assertEquals(5, ((Distance) ((Object[]) entry.getValue())[1]).getValue(), 0);
  }
View Full Code Here

  private void assertPredicate(Set<Predicate> entries, int position, OperationKey expectedKey, Object expectedValue) {
    assertPredicate(entries, position, expectedKey.getKey(), expectedValue);
  }

  private void assertPredicate(Set<Predicate> entries, int position, String expectedKey, Object expectedValue) {
    Predicate predicate = getPredicateByPosition(entries, position);
    Assert.assertEquals(expectedValue, predicate.getValue());
    Assert.assertEquals(expectedKey, predicate.getKey());
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.solr.core.query.Criteria.Predicate

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.