use of io.spine.type.TypeUrl in project core-java by SpineEventEngine.
the class KnownTypesShould method return_proto_type_url_by_proto_type_name.
@Test
public void return_proto_type_url_by_proto_type_name() {
final TypeUrl typeUrlExpected = TypeUrl.from(StringValue.getDescriptor());
final TypeUrl typeUrlActual = KnownTypes.getTypeUrl(typeUrlExpected.getTypeName());
assertEquals(typeUrlExpected, typeUrlActual);
}
use of io.spine.type.TypeUrl in project core-java by SpineEventEngine.
the class KnownTypesShould method return_java_inner_class_name_by_proto_type_url.
@Test
public void return_java_inner_class_name_by_proto_type_url() {
final TypeUrl typeUrl = TypeUrl.from(CommandContext.Schedule.getDescriptor());
final ClassName className = KnownTypes.getClassName(typeUrl);
assertEquals(ClassName.of(CommandContext.Schedule.class), className);
}
use of io.spine.type.TypeUrl in project core-java by SpineEventEngine.
the class KnownTypesShould method return_all_types_under_certain_package.
@Test
public void return_all_types_under_certain_package() {
final TypeUrl taskId = TypeUrl.from(TaskId.getDescriptor());
final TypeUrl taskName = TypeUrl.from(TaskName.getDescriptor());
final TypeUrl task = TypeUrl.from(Task.getDescriptor());
final String packageName = "spine.test.types";
final Collection<TypeUrl> packageTypes = getAllFromPackage(packageName);
assertSize(3, packageTypes);
assertTrue(packageTypes.containsAll(Arrays.asList(taskId, taskName, task)));
}
use of io.spine.type.TypeUrl in project core-java by SpineEventEngine.
the class KnownTypesShould method return_proto_type_url_by_java_class_name.
@Test
public void return_proto_type_url_by_java_class_name() {
final ClassName className = ClassName.of(Command.class);
final TypeUrl typeUrl = KnownTypes.getTypeUrl(className);
assertEquals(TypeUrl.from(Command.getDescriptor()), typeUrl);
}
use of io.spine.type.TypeUrl in project core-java by SpineEventEngine.
the class KnownTypesShould method throw_exception_if_no_java_class_name_by_type_url.
@Test(expected = UnknownTypeException.class)
public void throw_exception_if_no_java_class_name_by_type_url() {
final TypeUrl unexpectedUrl = TypeUrl.parse("prefix/unexpected.type");
KnownTypes.getClassName(unexpectedUrl);
}
Aggregations