Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ static Expr createDefaultValue(Field f, boolean useExplicitInitTypeInGenerics) {
}

if (f.type().equals(TypeNode.STRING)) {
String javaFieldName = JavaStyle.toLowerCamelCase(f.name());
return ValueExpr.withValue(
StringObjectValue.withValue(String.format("%s%s", f.name(), f.name().hashCode())));
StringObjectValue.withValue(
String.format("%s%s", javaFieldName, javaFieldName.hashCode())));
}

if (TypeNode.isNumericType(f.type())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ public void defaultValue_stringField() {
Expr expr = DefaultValueComposer.createDefaultValue(field);
expr.accept(writerVisitor);
assertEquals("\"foobar-1268878963\"", writerVisitor.write());

writerVisitor.clear();

// Original name is very clearly in lower_camel_case.
field = Field.builder().setName("foo_bar_baz").setType(TypeNode.STRING).build();
expr = DefaultValueComposer.createDefaultValue(field);
expr.accept(writerVisitor);
assertEquals("\"fooBarBaz-2082080914\"", writerVisitor.write());
}

@Test
Expand Down Expand Up @@ -281,7 +289,7 @@ public void createSimpleMessage_containsRepeatedField() {
expr.accept(writerVisitor);
assertEquals(
"PagedExpandResponse.newBuilder().addAllResponses(new ArrayList<EchoResponse>())"
+ ".setNextPageToken(\"next_page_token-1530815211\").build()",
+ ".setNextPageToken(\"nextPageToken-1386094857\").build()",
writerVisitor.write());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ public class EchoClientTest {
PagedExpandRequest.newBuilder()
.setContent("content951530617")
.setPageSize(883849137)
.setPageToken("page_token1630607433")
.setPageToken("pageToken873572522")
.build();

PagedExpandPagedResponse pagedListResponse = client.pagedExpand(request);
Expand Down Expand Up @@ -617,7 +617,7 @@ public class EchoClientTest {
PagedExpandRequest.newBuilder()
.setContent("content951530617")
.setPageSize(883849137)
.setPageToken("page_token1630607433")
.setPageToken("pageToken873572522")
.build();
client.pagedExpand(request);
Assert.fail("No exception raised");
Expand Down Expand Up @@ -663,7 +663,7 @@ public class EchoClientTest {
PagedExpandRequest.newBuilder()
.setContent("content951530617")
.setPageSize(883849137)
.setPageToken("page_token1630607433")
.setPageToken("pageToken873572522")
.build();
client.simplePagedExpand(request);
Assert.fail("No exception raised");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public class LoggingServiceV2ClientTest {
Empty expectedResponse = Empty.newBuilder().build();
mockLoggingServiceV2.addResponse(expectedResponse);

String logName = "log_name2013526694";
String logName = "logName341528559";

client.deleteLog(logName);

Expand All @@ -134,7 +134,7 @@ public class LoggingServiceV2ClientTest {
mockLoggingServiceV2.addException(exception);

try {
String logName = "log_name2013526694";
String logName = "logName341528559";
client.deleteLog(logName);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
Expand Down Expand Up @@ -192,7 +192,7 @@ public class LoggingServiceV2ClientTest {
WriteLogEntriesResponse expectedResponse = WriteLogEntriesResponse.newBuilder().build();
mockLoggingServiceV2.addResponse(expectedResponse);

String logName = "log_name2013526694";
String logName = "logName341528559";
MonitoredResource resource = MonitoredResource.newBuilder().build();
Map<String, String> labels = new HashMap<>();
List<LogEntry> entries = new ArrayList<>();
Expand Down Expand Up @@ -221,7 +221,7 @@ public class LoggingServiceV2ClientTest {
mockLoggingServiceV2.addException(exception);

try {
String logName = "log_name2013526694";
String logName = "logName341528559";
MonitoredResource resource = MonitoredResource.newBuilder().build();
Map<String, String> labels = new HashMap<>();
List<LogEntry> entries = new ArrayList<>();
Expand All @@ -244,7 +244,7 @@ public class LoggingServiceV2ClientTest {

List<String> resourceNames = new ArrayList<>();
String filter = "filter-1274492040";
String orderBy = "order_by1234304744";
String orderBy = "orderBy-1207110587";

ListLogEntriesPagedResponse pagedListResponse =
client.listLogEntries(resourceNames, filter, orderBy);
Expand Down Expand Up @@ -275,7 +275,7 @@ public class LoggingServiceV2ClientTest {
try {
List<String> resourceNames = new ArrayList<>();
String filter = "filter-1274492040";
String orderBy = "order_by1234304744";
String orderBy = "orderBy-1207110587";
client.listLogEntries(resourceNames, filter, orderBy);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
Expand All @@ -296,7 +296,7 @@ public class LoggingServiceV2ClientTest {
ListMonitoredResourceDescriptorsRequest request =
ListMonitoredResourceDescriptorsRequest.newBuilder()
.setPageSize(883849137)
.setPageToken("page_token1630607433")
.setPageToken("pageToken873572522")
.build();

ListMonitoredResourceDescriptorsPagedResponse pagedListResponse =
Expand Down Expand Up @@ -330,7 +330,7 @@ public class LoggingServiceV2ClientTest {
ListMonitoredResourceDescriptorsRequest request =
ListMonitoredResourceDescriptorsRequest.newBuilder()
.setPageSize(883849137)
.setPageToken("page_token1630607433")
.setPageToken("pageToken873572522")
.build();
client.listMonitoredResourceDescriptors(request);
Assert.fail("No exception raised");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ public class SubscriberClientTest {
.addAllModifyDeadlineSeconds(new ArrayList<Integer>())
.addAllModifyDeadlineAckIds(new ArrayList<String>())
.setStreamAckDeadlineSeconds(1875467245)
.setClientId("client_id-1904089585")
.setClientId("clientId908408390")
.setMaxOutstandingMessages(-1315266996)
.setMaxOutstandingBytes(-2103098517)
.build();
Expand Down Expand Up @@ -901,7 +901,7 @@ public class SubscriberClientTest {
.addAllModifyDeadlineSeconds(new ArrayList<Integer>())
.addAllModifyDeadlineAckIds(new ArrayList<String>())
.setStreamAckDeadlineSeconds(1875467245)
.setClientId("client_id-1904089585")
.setClientId("clientId908408390")
.setMaxOutstandingMessages(-1315266996)
.setMaxOutstandingBytes(-2103098517)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public class TestingClientTest {
ListSessionsRequest request =
ListSessionsRequest.newBuilder()
.setPageSize(883849137)
.setPageToken("page_token1630607433")
.setPageToken("pageToken873572522")
.build();

ListSessionsPagedResponse pagedListResponse = client.listSessions(request);
Expand Down Expand Up @@ -195,7 +195,7 @@ public class TestingClientTest {
ListSessionsRequest request =
ListSessionsRequest.newBuilder()
.setPageSize(883849137)
.setPageToken("page_token1630607433")
.setPageToken("pageToken873572522")
.build();
client.listSessions(request);
Assert.fail("No exception raised");
Expand Down Expand Up @@ -371,7 +371,7 @@ public class TestingClientTest {
ListTestsRequest.newBuilder()
.setParent(SessionName.of("[SESSION]").toString())
.setPageSize(883849137)
.setPageToken("page_token1630607433")
.setPageToken("pageToken873572522")
.build();

ListTestsPagedResponse pagedListResponse = client.listTests(request);
Expand Down Expand Up @@ -405,7 +405,7 @@ public class TestingClientTest {
ListTestsRequest.newBuilder()
.setParent(SessionName.of("[SESSION]").toString())
.setPageSize(883849137)
.setPageToken("page_token1630607433")
.setPageToken("pageToken873572522")
.build();
client.listTests(request);
Assert.fail("No exception raised");
Expand Down
20 changes: 10 additions & 10 deletions test/integration/goldens/library/LibraryServiceClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void listShelvesTest() throws Exception {
ListShelvesRequest request =
ListShelvesRequest.newBuilder()
.setPageSize(883849137)
.setPageToken("page_token1630607433")
.setPageToken("pageToken873572522")
.build();

ListShelvesPagedResponse pagedListResponse = client.listShelves(request);
Expand Down Expand Up @@ -258,7 +258,7 @@ public void listShelvesExceptionTest() throws Exception {
ListShelvesRequest request =
ListShelvesRequest.newBuilder()
.setPageSize(883849137)
.setPageToken("page_token1630607433")
.setPageToken("pageToken873572522")
.build();
client.listShelves(request);
Assert.fail("No exception raised");
Expand Down Expand Up @@ -387,7 +387,7 @@ public void mergeShelvesTest2() throws Exception {
mockLibraryService.addResponse(expectedResponse);

ShelfName name = ShelfName.of("[SHELF_ID]");
String otherShelfName = "other_shelf_name145746959";
String otherShelfName = "otherShelfName-1942963547";

Shelf actualResponse = client.mergeShelves(name, otherShelfName);
Assert.assertEquals(expectedResponse, actualResponse);
Expand All @@ -411,7 +411,7 @@ public void mergeShelvesExceptionTest2() throws Exception {

try {
ShelfName name = ShelfName.of("[SHELF_ID]");
String otherShelfName = "other_shelf_name145746959";
String otherShelfName = "otherShelfName-1942963547";
client.mergeShelves(name, otherShelfName);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
Expand Down Expand Up @@ -471,7 +471,7 @@ public void mergeShelvesTest4() throws Exception {
mockLibraryService.addResponse(expectedResponse);

String name = "name3373707";
String otherShelfName = "other_shelf_name145746959";
String otherShelfName = "otherShelfName-1942963547";

Shelf actualResponse = client.mergeShelves(name, otherShelfName);
Assert.assertEquals(expectedResponse, actualResponse);
Expand All @@ -495,7 +495,7 @@ public void mergeShelvesExceptionTest4() throws Exception {

try {
String name = "name3373707";
String otherShelfName = "other_shelf_name145746959";
String otherShelfName = "otherShelfName-1942963547";
client.mergeShelves(name, otherShelfName);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
Expand Down Expand Up @@ -892,7 +892,7 @@ public void moveBookTest2() throws Exception {
mockLibraryService.addResponse(expectedResponse);

BookName name = BookName.of("[SHELF_ID]", "[BOOK_ID]");
String otherShelfName = "other_shelf_name145746959";
String otherShelfName = "otherShelfName-1942963547";

Book actualResponse = client.moveBook(name, otherShelfName);
Assert.assertEquals(expectedResponse, actualResponse);
Expand All @@ -916,7 +916,7 @@ public void moveBookExceptionTest2() throws Exception {

try {
BookName name = BookName.of("[SHELF_ID]", "[BOOK_ID]");
String otherShelfName = "other_shelf_name145746959";
String otherShelfName = "otherShelfName-1942963547";
client.moveBook(name, otherShelfName);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
Expand Down Expand Up @@ -980,7 +980,7 @@ public void moveBookTest4() throws Exception {
mockLibraryService.addResponse(expectedResponse);

String name = "name3373707";
String otherShelfName = "other_shelf_name145746959";
String otherShelfName = "otherShelfName-1942963547";

Book actualResponse = client.moveBook(name, otherShelfName);
Assert.assertEquals(expectedResponse, actualResponse);
Expand All @@ -1004,7 +1004,7 @@ public void moveBookExceptionTest4() throws Exception {

try {
String name = "name3373707";
String otherShelfName = "other_shelf_name145746959";
String otherShelfName = "otherShelfName-1942963547";
client.moveBook(name, otherShelfName);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
Expand Down
Loading