Search in sources :

Example 1 with Project

use of io.spine.test.entity.Project in project core-java by SpineEventEngine.

the class EntityShould method return_default_state.

@Test
public void return_default_state() {
    final Project state = entityNew.getDefaultState();
    assertEquals(Project.getDefaultInstance(), state);
}
Also used : Project(io.spine.test.entity.Project) Test(org.junit.Test)

Example 2 with Project

use of io.spine.test.entity.Project in project core-java by SpineEventEngine.

the class EntityQueryMatcherShould method match_Any_instances.

@Test
public void match_Any_instances() {
    final String columnName = "column";
    final Project someMessage = Sample.messageOfType(Project.class);
    final Any actualValue = AnyPacker.pack(someMessage);
    final EntityColumn column = mock(EntityColumn.class);
    when(column.getType()).thenReturn(Any.class);
    when(column.getStoredName()).thenReturn(columnName);
    final EntityColumn.MemoizedValue value = mock(EntityColumn.MemoizedValue.class);
    when(value.getSourceColumn()).thenReturn(column);
    when(value.getValue()).thenReturn(actualValue);
    final EntityRecord record = Sample.messageOfType(EntityRecord.class);
    final Map<String, EntityColumn.MemoizedValue> columns = singletonMap(columnName, value);
    final EntityRecordWithColumns recordWithColumns = createRecord(record, columns);
    final Multimap<EntityColumn, ColumnFilter> filters = of(column, eq(columnName, actualValue));
    final CompositeQueryParameter parameter = createParams(filters, ALL);
    final QueryParameters parameters = QueryParameters.newBuilder().add(parameter).build();
    final EntityQuery<?> query = createQuery(emptySet(), parameters);
    final EntityQueryMatcher<?> matcher = new EntityQueryMatcher<>(query);
    assertTrue(matcher.apply(recordWithColumns));
}
Also used : EntityColumn(io.spine.server.entity.storage.EntityColumn) ColumnFilter(io.spine.client.ColumnFilter) QueryParameters(io.spine.server.entity.storage.QueryParameters) Any(com.google.protobuf.Any) EntityRecordWithColumns(io.spine.server.entity.storage.EntityRecordWithColumns) CompositeQueryParameter(io.spine.server.entity.storage.CompositeQueryParameter) EntityRecord(io.spine.server.entity.EntityRecord) Project(io.spine.test.entity.Project) Test(org.junit.Test)

Aggregations

Project (io.spine.test.entity.Project)2 Test (org.junit.Test)2 Any (com.google.protobuf.Any)1 ColumnFilter (io.spine.client.ColumnFilter)1 EntityRecord (io.spine.server.entity.EntityRecord)1 CompositeQueryParameter (io.spine.server.entity.storage.CompositeQueryParameter)1 EntityColumn (io.spine.server.entity.storage.EntityColumn)1 EntityRecordWithColumns (io.spine.server.entity.storage.EntityRecordWithColumns)1 QueryParameters (io.spine.server.entity.storage.QueryParameters)1