use of io.spine.users.UserId in project core-java by SpineEventEngine.
the class JsonShould method print_to_compact_json.
@Test
public void print_to_compact_json() {
final String idValue = newUuid();
final UserId userId = UserId.newBuilder().setValue(idValue).build();
final String result = toCompactJson(userId);
assertFalse(result.isEmpty());
assertFalse(result.contains(System.lineSeparator()));
}
use of io.spine.users.UserId in project core-java by SpineEventEngine.
the class AnyPackerShould method unpack_spine_message_from_Any.
@Test
public void unpack_spine_message_from_Any() {
final Any any = AnyPacker.pack(spineMsg);
final UserId actual = AnyPacker.unpack(any);
assertEquals(spineMsg, actual);
}
use of io.spine.users.UserId in project core-java by SpineEventEngine.
the class CommandFactoryShould method create_command_context.
@Test
public void create_command_context() {
final TenantId tenantId = newTenantUuid();
final UserId userId = newUserUuid();
final ZoneOffset zoneOffset = ZoneOffsets.ofHours(-3);
final int targetVersion = 100500;
final CommandContext commandContext = CommandFactory.createContext(tenantId, userId, zoneOffset, targetVersion);
final ActorContext actorContext = commandContext.getActorContext();
assertEquals(tenantId, actorContext.getTenantId());
assertEquals(userId, actorContext.getActor());
assertEquals(zoneOffset, actorContext.getZoneOffset());
assertEquals(targetVersion, commandContext.getTargetVersion());
}
use of io.spine.users.UserId in project core-java by SpineEventEngine.
the class TestCommandContextFactory method createCommandContext.
/** Creates a new {@link CommandContext} instance. */
public static CommandContext createCommandContext() {
final UserId userId = newUserId(newUuid());
final Timestamp now = getCurrentTime();
return createCommandContext(userId, now);
}
use of io.spine.users.UserId in project core-java by SpineEventEngine.
the class StringifiersShould method convert_from_json_to_message.
@Test
public void convert_from_json_to_message() {
final Stringifier<UserId> messageStringifier = StringifierRegistry.getStringifier(UserId.class);
final String idValue = newUuid();
final UserId result = messageStringifier.reverse().convert("{value:" + idValue + '}');
assertNotNull(result);
assertEquals(idValue, result.getValue());
}
Aggregations