Skip to content

Commit 60863c7

Browse files
committed
Fix tests after refactoring the column API
1 parent 7bae1e7 commit 60863c7

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

datastore/src/test/java/io/spine/server/storage/datastore/DsRecordStorageTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
import static io.spine.server.storage.datastore.given.DsRecordStorageTestEnv.recordIds;
114114
import static io.spine.server.storage.datastore.given.DsRecordStorageTestEnv.sortedIds;
115115
import static io.spine.server.storage.datastore.given.TestEnvironment.singleTenantSpec;
116+
import static io.spine.test.storage.Project.Status.STARTED;
116117
import static java.util.Collections.singletonList;
117118
import static java.util.stream.Collectors.toList;
118119
import static org.junit.Assert.assertFalse;
@@ -155,7 +156,7 @@ protected Message newState(ProjectId projectId) {
155156
private EntityRecordWithColumns newRecordWithColumns(RecordStorage<ProjectId> storage) {
156157
EntityRecord record = newStorageRecord();
157158
Entity<ProjectId, Project> entity = new TestCounterEntity(newId());
158-
EntityRecordWithColumns recordWithColumns = create(record, entity, storage);
159+
EntityRecordWithColumns recordWithColumns = create(record, entity, storage.entityClass());
159160
return recordWithColumns;
160161
}
161162

@@ -209,6 +210,7 @@ void testPersistColumns() {
209210

210211
ProjectId id = newId();
211212
TestCounterEntity entity = new TestCounterEntity(id);
213+
entity.assignStatus(STARTED);
212214
Project state = entity.state();
213215
Version versionValue = entity.version();
214216
EntityRecord record = EntityRecord
@@ -218,7 +220,7 @@ void testPersistColumns() {
218220
.setVersion(versionValue)
219221
.vBuild();
220222
DsRecordStorage<ProjectId> storage = newStorage(TestCounterEntity.class);
221-
EntityRecordWithColumns recordWithColumns = create(record, entity, storage);
223+
EntityRecordWithColumns recordWithColumns = create(record, entity, storage.entityClass());
222224
ImmutableSet<String> columns = recordWithColumns.columnNames()
223225
.stream()
224226
.map(ColumnName::value)
@@ -316,7 +318,7 @@ void testLifecycleFlags() {
316318
.vBuild();
317319
TestCounterEntity entity = new TestCounterEntity(id);
318320
RecordStorage<ProjectId> storage = newStorage(TestCounterEntity.class);
319-
EntityRecordWithColumns recordWithColumns = create(record, entity, storage);
321+
EntityRecordWithColumns recordWithColumns = create(record, entity, storage.entityClass());
320322
storage.write(id, recordWithColumns);
321323

322324
RecordReadRequest<ProjectId> request = new RecordReadRequest<>(id);
@@ -595,7 +597,7 @@ void testQueryEntityWithoutLifecycleById() {
595597
ProjectId id = newId();
596598
EntityRecord record = newEntityRecord(id, newState(id));
597599
EntityWithoutLifecycle entity = new EntityWithoutLifecycle(id);
598-
storage.writeRecord(entity.id(), create(record, entity, storage));
600+
storage.writeRecord(entity.id(), create(record, entity, storage.entityClass()));
599601

600602
// Create ID filter.
601603
List<Any> targetIds = singletonList(pack(entity.id()));

datastore/src/test/java/io/spine/server/storage/datastore/given/DsRecordStorageTestEnv.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ private static CollegeEntity createAndStoreEntity(RecordStorage<CollegeId> stora
256256

257257
public static void storeEntity(RecordStorage<CollegeId> storage, CollegeEntity entity) {
258258
EntityRecord record = newEntityRecord(entity.id(), entity.state());
259-
EntityRecordWithColumns withColumns = create(record, entity, storage);
259+
EntityRecordWithColumns withColumns = create(record, entity, storage.entityClass());
260260
storage.write(entity.id(), withColumns);
261261
}
262262

datastore/src/test/java/io/spine/server/storage/datastore/type/DsStorageRulesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void byteStringAsBlobValue() {
111111
@DisplayName("`Enum` as `LongValue`")
112112
void enumAsLongValue() {
113113
Status value = Status.CREATED;
114-
assertConverts(value, LongValue.of(value.ordinal()));
114+
assertConverts(value, LongValue.of(value.getNumber()));
115115
}
116116

117117
@Test

0 commit comments

Comments
 (0)