Skip to content

Commit

Permalink
fix: use both map generics in ServiceClientTest codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
miraleung committed Oct 29, 2020
1 parent 602e1df commit 07dddb8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ static Expr createDefaultValue(Field f, boolean useExplicitInitTypeInGenerics) {
ConcreteReference.Builder refBuilder =
ConcreteReference.builder().setClazz(f.isMap() ? HashMap.class : ArrayList.class);
if (useExplicitInitTypeInGenerics) {
refBuilder = refBuilder.setGenerics(f.type().reference().generics().get(0));
if (f.isMap()) {
refBuilder = refBuilder.setGenerics(f.type().reference().generics().subList(0, 2));
} else {
refBuilder = refBuilder.setGenerics(f.type().reference().generics().get(0));
}
}

TypeNode newType = TypeNode.withReference(refBuilder.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class SubscriberClientTest {
.setPushConfig(PushConfig.newBuilder().build())
.setAckDeadlineSeconds(2135351438)
.setRetainAckedMessages(true)
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.setEnableMessageOrdering(true)
.setExpirationPolicy(ExpirationPolicy.newBuilder().build())
.setFilter("filter-1274492040")
Expand Down Expand Up @@ -140,7 +140,7 @@ public class SubscriberClientTest {
.setPushConfig(PushConfig.newBuilder().build())
.setAckDeadlineSeconds(2135351438)
.setRetainAckedMessages(true)
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.setEnableMessageOrdering(true)
.setExpirationPolicy(ExpirationPolicy.newBuilder().build())
.setFilter("filter-1274492040")
Expand Down Expand Up @@ -199,7 +199,7 @@ public class SubscriberClientTest {
.setPushConfig(PushConfig.newBuilder().build())
.setAckDeadlineSeconds(2135351438)
.setRetainAckedMessages(true)
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.setEnableMessageOrdering(true)
.setExpirationPolicy(ExpirationPolicy.newBuilder().build())
.setFilter("filter-1274492040")
Expand Down Expand Up @@ -258,7 +258,7 @@ public class SubscriberClientTest {
.setPushConfig(PushConfig.newBuilder().build())
.setAckDeadlineSeconds(2135351438)
.setRetainAckedMessages(true)
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.setEnableMessageOrdering(true)
.setExpirationPolicy(ExpirationPolicy.newBuilder().build())
.setFilter("filter-1274492040")
Expand Down Expand Up @@ -317,7 +317,7 @@ public class SubscriberClientTest {
.setPushConfig(PushConfig.newBuilder().build())
.setAckDeadlineSeconds(2135351438)
.setRetainAckedMessages(true)
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.setEnableMessageOrdering(true)
.setExpirationPolicy(ExpirationPolicy.newBuilder().build())
.setFilter("filter-1274492040")
Expand Down Expand Up @@ -366,7 +366,7 @@ public class SubscriberClientTest {
.setPushConfig(PushConfig.newBuilder().build())
.setAckDeadlineSeconds(2135351438)
.setRetainAckedMessages(true)
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.setEnableMessageOrdering(true)
.setExpirationPolicy(ExpirationPolicy.newBuilder().build())
.setFilter("filter-1274492040")
Expand Down Expand Up @@ -415,7 +415,7 @@ public class SubscriberClientTest {
.setPushConfig(PushConfig.newBuilder().build())
.setAckDeadlineSeconds(2135351438)
.setRetainAckedMessages(true)
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.setEnableMessageOrdering(true)
.setExpirationPolicy(ExpirationPolicy.newBuilder().build())
.setFilter("filter-1274492040")
Expand Down Expand Up @@ -1013,7 +1013,7 @@ public class SubscriberClientTest {
Snapshot.newBuilder()
.setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
.setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.build();
mockSubscriber.addResponse(expectedResponse);

Expand Down Expand Up @@ -1053,7 +1053,7 @@ public class SubscriberClientTest {
Snapshot.newBuilder()
.setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
.setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.build();
mockSubscriber.addResponse(expectedResponse);

Expand Down Expand Up @@ -1181,7 +1181,7 @@ public class SubscriberClientTest {
Snapshot.newBuilder()
.setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
.setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.build();
mockSubscriber.addResponse(expectedResponse);

Expand Down Expand Up @@ -1224,7 +1224,7 @@ public class SubscriberClientTest {
Snapshot.newBuilder()
.setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
.setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.build();
mockSubscriber.addResponse(expectedResponse);

Expand Down Expand Up @@ -1267,7 +1267,7 @@ public class SubscriberClientTest {
Snapshot.newBuilder()
.setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
.setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.build();
mockSubscriber.addResponse(expectedResponse);

Expand Down Expand Up @@ -1310,7 +1310,7 @@ public class SubscriberClientTest {
Snapshot.newBuilder()
.setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
.setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.build();
mockSubscriber.addResponse(expectedResponse);

Expand Down Expand Up @@ -1353,7 +1353,7 @@ public class SubscriberClientTest {
Snapshot.newBuilder()
.setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
.setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.build();
mockSubscriber.addResponse(expectedResponse);

Expand Down

0 comments on commit 07dddb8

Please sign in to comment.