### Question:
Proto2Java extends AbstractMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { try { if (Objects.nonNull(project)) { project.addCompileSourceRoot(generatedSourceDirectory); } String raptorLocation = JavaGenerator.class.getProtectionDomain().getCodeSource().getLocation().getPath(); List<String> directories = protoPaths != null && protoPaths.length > 0 ? Arrays.asList(protoPaths) : Lists.newArrayList(protoSourceDirectory, raptorLocation); SchemaLoader schemaLoader = new SchemaLoader(); for (String directory : directories) { schemaLoader.addSource(new File(directory)); } if (Objects.nonNull(protoFiles)) { for (String proto : protoFiles) { schemaLoader.addProto(proto); } } Schema schema = schemaLoader.load(); JavaGenerator javaGenerator = JavaGenerator.get(schema); CodegenFilter codegenFilter = CodegenFilterFactory.create(); for (ProtoFile protoFile : schema.protoFiles()) { if(codegenFilter.filterByProtoFile(protoFile)){ for (Type type : protoFile.types()) { ClassName javaTypeName = javaGenerator.generatedTypeName(type); TypeSpec typeSpec = javaGenerator.generateType(protoFile, type); writeJavaFile(javaTypeName, typeSpec, type.location().withPathOnly()); } for (Service service : protoFile.services()) { TypeSpec typeSpec = javaGenerator.generateService(protoFile, service); ClassName typeName = (ClassName) javaGenerator.typeName(service.type()); writeJavaFile(typeName, typeSpec, service.location().withPathOnly()); } } } } catch (Exception e) { throw new MojoExecutionException("Wire Plugin: Failure compiling proto sources.", e); } }  @Override void execute();  }### Answer:
@Test public void testProto2java() throws IllegalAccessException, MojoFailureException, MojoExecutionException { Proto2Java mojo = new Proto2Java(); setVariableValueToObject(mojo, "protoSourceDirectory", "src/test/resources/proto"); setVariableValueToObject(mojo, "generatedSourceDirectory", "target/generated-sources/"); mojo.execute(); }