Package com.rapleaf.jack.test_project.database_1.iface

Examples of com.rapleaf.jack.test_project.database_1.iface.IUserPersistence.query()


        .find();
    assertTrue(result.isEmpty());

    // NotIn with empty collection
    try {
      users.query().whereSomeDatetime(notIn(Collections.<Long>emptySet()))
          .find();
      fail("Using a NotIn operator with an empty collection should throw an exception.");
    } catch (IllegalArgumentException e) {
      //This is expected
    }
View Full Code Here


    } catch (IllegalArgumentException e) {
      //This is expected
    }

    // Contains and In
    result = users.query().whereBio(contains("f"))
        .whereNumPosts(in(1, 3, 5))
        .find();
    assertEquals(1, result.size());
    assertTrue(result.contains(james));
View Full Code Here

        .find();
    assertEquals(1, result.size());
    assertTrue(result.contains(james));

    // Not In and Not Equal To
    result = users.query().whereHandle(notIn("Brad", "Brandon", "Jennifer", "John"))
        .whereNumPosts(notEqualTo(5))
        .find();
    assertEquals(1, result.size());
    assertTrue(result.contains(casey));
View Full Code Here

        .whereNumPosts(notEqualTo(5))
        .find();
    assertEquals(1, result.size());
    assertTrue(result.contains(casey));

    result = users.query().whereSomeDatetime(JackMatchers.<Long>isNull()).find();
    assertEquals(3, result.size());

    result = users.query().whereSomeDatetime(JackMatchers.<Long>isNotNull()).find();
    assertEquals(2, result.size());
    assertTrue(result.contains(brandon));
View Full Code Here

    assertTrue(result.contains(casey));

    result = users.query().whereSomeDatetime(JackMatchers.<Long>isNull()).find();
    assertEquals(3, result.size());

    result = users.query().whereSomeDatetime(JackMatchers.<Long>isNotNull()).find();
    assertEquals(2, result.size());
    assertTrue(result.contains(brandon));
    assertTrue(result.contains(james));

    // If a null parameter is passed, an exeception should be thrown
View Full Code Here

    assertTrue(result.contains(brandon));
    assertTrue(result.contains(james));

    // If a null parameter is passed, an exeception should be thrown
    try {
      users.query().whereHandle(in(null, "brandon")).find();
      fail("an In query with one null parameter should throw an exception");
    } catch (IllegalArgumentException e) {
      // This exception is expected
    }
  }
View Full Code Here

    }

    Set<User> result;

    // Query by one id
    result = users.query().id(sampleUsers[0].getId()).find();
    assertEquals(1, result.size());
    assertTrue(result.contains(sampleUsers[0]));

    // Query by several ids
    Set<Long> sampleIds = new HashSet<Long>();
View Full Code Here

    // Query by several ids
    Set<Long> sampleIds = new HashSet<Long>();
    sampleIds.add(sampleUsers[0].getId());
    sampleIds.add(sampleUsers[3].getId());
    sampleIds.add(sampleUsers[4].getId());
    result = users.query().idIn(sampleIds).find();
    assertEquals(3, result.size());
    assertTrue(result.contains(sampleUsers[0]));
    assertTrue(result.contains(sampleUsers[3]));
    assertTrue(result.contains(sampleUsers[4]));
View Full Code Here

    //Query by several ids and constraints
    Set<Long> sampleIds2 = new HashSet<Long>();
    sampleIds2.add(sampleUsers[2].getId());
    sampleIds2.add(sampleUsers[3].getId());

    result = users.query()
        .whereNumPosts(greaterThan(0))
        .idIn(sampleIds2)
        .find();
    assertEquals(1, result.size());
    assertTrue(result.contains(sampleUsers[3]));
View Full Code Here

    List<User> orderedResult1;
    List<User> orderedResult2;

    // An empty query should return an empty list.
    orderedResult1 = users.query().findWithOrder();
    assertTrue(orderedResult1.isEmpty());

    // A query with no results should return an empty list.
    orderedResult1 = users.query().numPosts(3).bio("CEO").order().findWithOrder();
    assertTrue(orderedResult1.isEmpty());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.