Package com.salesforce.jprotoc
Class ProtocPluginTesting
- java.lang.Object
-
- com.salesforce.jprotoc.ProtocPluginTesting
-
public final class ProtocPluginTesting extends Object
This method is designed to be used by unit tests. Unit testing typically works like this: 1. Add the Dump protoc plugin to your test code generation build phase, to write out a proto dump file. 2. Locate the generated dump file in a unit test. 3. Call this method, with the path of the dump file from a test. 4. Inspect the generated output.
-
-
Field Summary
Fields Modifier and Type Field Description static StringMAVEN_DUMP_PATH
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponsetest(Generator generator, String dumpPath)Debug a single generator using the parsed proto descriptor.static com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponsetest(List<Generator> generators, String dumpPath)Debug multiple generators using the parsed proto descriptor, aggregating their results.static com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponsetest(List<Generator> generators, List<com.google.protobuf.GeneratedMessage.GeneratedExtension> extensions, String dumpPath)Test multiple generators using the parsed proto descriptor, aggregating their results.
-
-
-
Field Detail
-
MAVEN_DUMP_PATH
public static final String MAVEN_DUMP_PATH
- See Also:
- Constant Field Values
-
-
Method Detail
-
test
public static com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse test(@Nonnull Generator generator, @Nonnull String dumpPath) throws IOException
Debug a single generator using the parsed proto descriptor.- Parameters:
generator- The generator to run.dumpPath- The path to a descriptor dump on the filesystem.- Returns:
- The compiled output from the protoc plugin
- Throws:
IOException
-
test
public static com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse test(@Nonnull List<Generator> generators, @Nonnull String dumpPath) throws IOException
Debug multiple generators using the parsed proto descriptor, aggregating their results.- Parameters:
generators- The list of generators to run.dumpPath- The path to a descriptor dump on the filesystem.- Returns:
- The compiled output from the protoc plugin
- Throws:
IOException
-
test
public static com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse test(@Nonnull List<Generator> generators, List<com.google.protobuf.GeneratedMessage.GeneratedExtension> extensions, @Nonnull String dumpPath) throws IOException
Test multiple generators using the parsed proto descriptor, aggregating their results. Also register the given extensions so they may be processed by the generator.- Parameters:
generators- The list of generators to run.extensions- The list of extensions to register.dumpPath- The path to a descriptor dump on the filesystem.- Returns:
- The compiled output from the protoc plugin
- Throws:
IOException
-
-