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

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


  }

  @Test
  public void testSloppy() {
    Criteria criteria = new Criteria("field_1").sloppy("value0 value1", 2);
    Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0);
    Assert.assertEquals("value0 value1", ((Object[]) entry.getValue())[0]);
    Assert.assertEquals(2, ((Object[]) entry.getValue())[1]);
  }
View Full Code Here


  }

  @Test
  public void testBetween() {
    Criteria criteria = new Criteria("field_1").between(100, 200);
    Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0);
    Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey());
    Assert.assertEquals(100, ((Object[]) entry.getValue())[0]);
    Assert.assertEquals(200, ((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 testBetweenWithoutUpperBound() {
    Criteria criteria = new Criteria("field_1").between(100, null);
    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 testBetweenWithoutLowerBound() {
    Criteria criteria = new Criteria("field_1").between(null, 200);
    Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0);
    Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey());
    Assert.assertNull(((Object[]) entry.getValue())[0]);
    Assert.assertEquals(200, ((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 testBetweenExcludingLowerBound() {
    Criteria criteria = new Criteria("field_1").between(100, 200, false, true);
    Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0);
    Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey());
    Assert.assertEquals(100, ((Object[]) entry.getValue())[0]);
    Assert.assertEquals(200, ((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 testBetweenExcludingUpperBound() {
    Criteria criteria = new Criteria("field_1").between(100, 200, true, false);
    Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0);
    Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey());
    Assert.assertEquals(100, ((Object[]) entry.getValue())[0]);
    Assert.assertEquals(200, ((Object[]) entry.getValue())[1]);
    Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue());
    Assert.assertFalse(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue());
  }
View Full Code Here

  }

  @Test
  public void testBetweenWithoutLowerAndUpperBound() {
    Criteria criteria = new Criteria("field_1").between(null, 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 testLessThan() {
    Criteria criteria = new Criteria("field_1").lessThan(200);
    Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0);
    Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey());
    Assert.assertNull(((Object[]) entry.getValue())[0]);
    Assert.assertEquals(200, ((Object[]) entry.getValue())[1]);
    Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue());
    Assert.assertFalse(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue());
  }
View Full Code Here

  }

  @Test
  public void testLessThanEqual() {
    Criteria criteria = new Criteria("field_1").lessThanEqual(200);
    Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0);
    Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey());
    Assert.assertNull(((Object[]) entry.getValue())[0]);
    Assert.assertEquals(200, ((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 testLessThanEqualNull() {
    Criteria criteria = new Criteria("field_1").lessThanEqual(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

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.