Closed verokarhu closed 8 years ago
Can you explain me why you would ever want to mock a FlatBuffers generated API? To test against the real API, all you need is a single buffer, or a single file (no moving parts, simple). To create a mock, you'd have to implement all the accessors, which is not only way more work, but it would break as soon as the schema changes since it is generated code.
@verokarhu can you give a code example of how an interface would save you effort? I agree with @gwvo that this does not seem like it would help.
Actually, using files does sound simpler, I hadn't even considered that. I was afraid that hand-crafting buffers or building the messages with flatbuffers would be the only way, which sounded more tedious than implementing the accessors. Chalk it up to a lack of RTFM or maybe interface fever.
Thanks!
Generating an interface for the generated messages would make mocking them easier. Creating real messages or prefilling the message structs with data makes unit testing functions that use flatbuffers needlessly complicated.