Search in sources :

Example 6 with Person

use of com.baeldung.couchbase.async.person.Person in project tutorials by eugenp.

the class PersonCrudServiceIntegrationTest method givenIds_whenReadBulk_thenReturnsOnlyPersonsWithMatchingIds.

@Test
public final void givenIds_whenReadBulk_thenReturnsOnlyPersonsWithMatchingIds() {
    List<String> ids = new ArrayList<>();
    // add some person documents
    for (int i = 0; i < 5; i++) {
        ids.add(insertRandomPersonDocument().id());
    }
    // perform bulk read
    List<Person> persons = personService.readBulk(ids);
    // check results
    for (Person person : persons) {
        assertTrue(ids.contains(person.getId()));
    }
    // cleanup
    for (String id : ids) {
        bucket.remove(id);
    }
}
Also used : ArrayList(java.util.ArrayList) Person(com.baeldung.couchbase.async.person.Person) Test(org.junit.Test) AsyncIntegrationTest(com.baeldung.couchbase.async.AsyncIntegrationTest)

Aggregations

Person (com.baeldung.couchbase.async.person.Person)6 AsyncIntegrationTest (com.baeldung.couchbase.async.AsyncIntegrationTest)5 Test (org.junit.Test)5 JsonDocument (com.couchbase.client.java.document.JsonDocument)3 ArrayList (java.util.ArrayList)3