use of com.google.api.tools.framework.model.EnumValue in project toolkit by googleapis.
the class NodeJSModelTypeNameConverterTest method testGetEnumValue.
@Test
public void testGetEnumValue() {
String packageName = "library.v1";
TypeRef type = ModelTypeNameConverterTestUtil.getTestEnumType(tempDir);
EnumValue value = type.getEnumType().getValues().get(0);
NodeJSModelTypeNameConverter converter = new NodeJSModelTypeNameConverter(packageName);
Truth.assertThat(converter.getEnumValue(type, value).getValueAndSaveTypeNicknameIn(new JSTypeTable(packageName))).isEqualTo("'GOOD'");
}
use of com.google.api.tools.framework.model.EnumValue in project toolkit by googleapis.
the class PhpModelTypeNameConverterTest method testGetEnumValue.
@Test
public void testGetEnumValue() {
String packageName = "Google\\Example\\Library\\V1";
TypeRef type = ModelTypeNameConverterTestUtil.getTestEnumType(tempDir);
EnumValue value = type.getEnumType().getValues().get(0);
PhpModelTypeNameConverter converter = new PhpModelTypeNameConverter(packageName);
Truth.assertThat(converter.getEnumValue(type, value).getValueAndSaveTypeNicknameIn(new PhpTypeTable(packageName))).isEqualTo("Book_Rating::GOOD");
}
use of com.google.api.tools.framework.model.EnumValue in project toolkit by googleapis.
the class GrpcElementDocTransformer method generateEnumValueDocs.
private List<GrpcEnumValueDocView> generateEnumValueDocs(SurfaceNamer namer, EnumType enumElement) {
ImmutableList.Builder<GrpcEnumValueDocView> valueDocs = ImmutableList.builder();
for (EnumValue value : enumElement.getValues()) {
GrpcEnumValueDocView.Builder doc = GrpcEnumValueDocView.newBuilder();
doc.name(value.getSimpleName());
doc.number(value.getNumber());
doc.lines(namer.getDocLines(GapicParser.getDocString(value)));
valueDocs.add(doc.build());
}
return valueDocs.build();
}
use of com.google.api.tools.framework.model.EnumValue in project toolkit by googleapis.
the class CSharpModelTypeNameConverterTest method testGetEnumValue.
@Test
public void testGetEnumValue() {
String packageName = "Google.Example.Library.V1";
TypeRef type = ModelTypeNameConverterTestUtil.getTestEnumType(tempDir);
EnumValue value = type.getEnumType().getValues().get(0);
CSharpModelTypeNameConverter converter = new CSharpModelTypeNameConverter(packageName);
Truth.assertThat(converter.getEnumValue(type, value).getValueAndSaveTypeNicknameIn(new CSharpTypeTable(packageName))).isEqualTo("Book.Types.Rating.Good");
}
use of com.google.api.tools.framework.model.EnumValue in project toolkit by googleapis.
the class GoModelTypeNameConverterTest method testGetEnumValue.
@Test
public void testGetEnumValue() {
TypeRef type = ModelTypeNameConverterTestUtil.getTestEnumType(tempDir);
EnumValue value = type.getEnumType().getValues().get(0);
Truth.assertThat(converter.getEnumValue(type, value).getValueAndSaveTypeNicknameIn(new GoTypeTable())).isEqualTo("librarypb.Book_GOOD");
type = ModelTypeNameConverterTestUtil.getTestType(tempDir, "TopLevelEnum");
value = type.getEnumType().getValues().get(0);
Truth.assertThat(converter.getEnumValue(type, value).getValueAndSaveTypeNicknameIn(new GoTypeTable())).isEqualTo("librarypb.TopLevelEnum_FOO");
}
Aggregations