Are you using the getFooBuilder() methods? A common practice for tests is to use the TextFormat: you can write out the string representation of the pb you want, and then parse into a PB object. Or you could narrow the API of your methods under test to take only the submessages that they need.
On Wed, Aug 29, 2012 at 3:50 PM, Carl Mastrangelo <notc...@google.com>wrote: > Noogler here, > > I am wondering if there is a good way to test methods that take protos as > parameters? For each of my test methods, I seem to have to create a pretty > complicated proto only to set a single field nested deep inside. This > results in a lot of setup code for my tests. Is there a faster way to make > test protos that only have a couple fields set (or intentionally not set) ? > So far I have been using .buildPartial() to shorten code, but it still > seems pretty long. > > The language is Java for reference. > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/protobuf/-/83boIWdtqcoJ. > To post to this group, send email to protobuf@googlegroups.com. > To unsubscribe from this group, send email to > protobuf+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.