Search in sources :

Example 1 with TestEntityId

use of io.spine.test.client.TestEntityId in project core-java by SpineEventEngine.

the class TopicFactoryShould method create_topic_for_some_entities_of_kind.

@Test
public void create_topic_for_some_entities_of_kind() {
    final Set<TestEntityId> ids = newHashSet(entityId(1), entityId(2), entityId(3));
    final Topic topic = factory().topic().someOf(TARGET_ENTITY_CLASS, ids);
    verifyTargetAndContext(topic);
    final List<EntityId> actualIds = topic.getTarget().getFilters().getIdFilter().getIdsList();
    assertEquals(ids.size(), actualIds.size());
    for (EntityId actualId : actualIds) {
        final Any rawId = actualId.getId();
        final TestEntityId unpackedId = AnyPacker.unpack(rawId);
        assertTrue(ids.contains(unpackedId));
    }
}
Also used : TestEntityId(io.spine.test.client.TestEntityId) EntityId(io.spine.client.EntityId) TestEntityId(io.spine.test.client.TestEntityId) Any(com.google.protobuf.Any) Test(org.junit.Test)

Example 2 with TestEntityId

use of io.spine.test.client.TestEntityId in project core-java by SpineEventEngine.

the class QueryFactoryShould method verifyIdFilter.

private static void verifyIdFilter(Set<TestEntityId> expectedIds, EntityFilters filters) {
    assertNotNull(filters);
    final EntityIdFilter idFilter = filters.getIdFilter();
    assertNotNull(idFilter);
    final List<EntityId> actualListOfIds = idFilter.getIdsList();
    for (TestEntityId testEntityId : expectedIds) {
        final EntityId expectedEntityId = EntityId.newBuilder().setId(AnyPacker.pack(testEntityId)).build();
        assertTrue(actualListOfIds.contains(expectedEntityId));
    }
}
Also used : TestEntityId(io.spine.test.client.TestEntityId) TestEntityId(io.spine.test.client.TestEntityId)

Aggregations

TestEntityId (io.spine.test.client.TestEntityId)2 Any (com.google.protobuf.Any)1 EntityId (io.spine.client.EntityId)1 Test (org.junit.Test)1