### Question:
DefaultGenerator implements Generator { @SuppressWarnings("deprecation") @Override public Generator opts(ClientOptInput opts) { this.opts = opts; this.openAPI = opts.getOpenAPI(); this.config = opts.getConfig(); List<TemplateDefinition> userFiles = opts.getUserDefinedTemplates(); if (userFiles != null) { this.userDefinedTemplates = ImmutableList.copyOf(userFiles); } TemplateManagerOptions templateManagerOptions = new TemplateManagerOptions(this.config.isEnableMinimalUpdate(),this.config.isSkipOverwrite()); if (this.dryRun) { this.templateProcessor = new DryRunTemplateManager(templateManagerOptions); } else { TemplatingEngineAdapter templatingEngine = this.config.getTemplatingEngine(); if (templatingEngine instanceof MustacheEngineAdapter) { MustacheEngineAdapter mustacheEngineAdapter = (MustacheEngineAdapter) templatingEngine; mustacheEngineAdapter.setCompiler(this.config.processCompiler(mustacheEngineAdapter.getCompiler())); } TemplatePathLocator commonTemplateLocator = new CommonTemplateContentLocator(); TemplatePathLocator generatorTemplateLocator = new GeneratorTemplateContentLocator(this.config); this.templateProcessor = new TemplateManager( templateManagerOptions, templatingEngine, new TemplatePathLocator[]{generatorTemplateLocator, commonTemplateLocator} ); } String ignoreFileLocation = this.config.getIgnoreFilePathOverride(); if (ignoreFileLocation != null) { final File ignoreFile = new File(ignoreFileLocation); if (ignoreFile.exists() && ignoreFile.canRead()) { this.ignoreProcessor = new CodegenIgnoreProcessor(ignoreFile); } else { LOGGER.warn("Ignore file specified at {} is not valid. This will fall back to an existing ignore file if present in the output directory.", ignoreFileLocation); } } if (this.ignoreProcessor == null) { this.ignoreProcessor = new CodegenIgnoreProcessor(this.config.getOutputDir()); } return this; } DefaultGenerator();  DefaultGenerator(Boolean dryRun); @SuppressWarnings("deprecation") @Override Generator opts(ClientOptInput opts); TemplateProcessor getTemplateProcessor(); @SuppressWarnings("WeakerAccess") void setGenerateMetadata(Boolean generateMetadata); @SuppressWarnings("WeakerAccess") void setGeneratorPropertyDefault(final String key, final String value); @Override List<File> generate(); Map<String, List<CodegenOperation>> processPaths(Paths paths);  }### Answer:
@Test public void testRefModelValidationProperties() { OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/2_0/refAliasedPrimitiveWithValidation.yml"); ClientOptInput opts = new ClientOptInput(); opts.setOpenAPI(openAPI); DefaultCodegen config = new DefaultCodegen(); config.setStrictSpecBehavior(false); opts.setConfig(config); DefaultGenerator generator = new DefaultGenerator(); generator.opts(opts); String expectedPattern = "^\\d{3}-\\d{2}-\\d{4}$"; String escapedPattern = config.toRegularExpression(expectedPattern); Schema stringRegex = openAPI.getComponents().getSchemas().get("StringRegex"); Assert.assertEquals(stringRegex.getPattern(), expectedPattern); Schema unaliasedStringRegex = ModelUtils.unaliasSchema(openAPI, stringRegex); Assert.assertEquals(unaliasedStringRegex.getPattern(), expectedPattern); CodegenProperty stringRegexProperty = config.fromProperty("stringRegex", stringRegex); Assert.assertEquals(stringRegexProperty.pattern, escapedPattern); Operation operation = openAPI.getPaths().get("/fake/StringRegex").getPost(); RequestBody body = operation.getRequestBody(); CodegenParameter codegenParameter = config.fromRequestBody(body, new HashSet<>(), "body"); Assert.assertEquals(codegenParameter.pattern, escapedPattern); ApiResponse response = operation.getResponses().get("200"); CodegenResponse codegenResponse = config.fromResponse("200", response); Assert.assertEquals(((Schema) codegenResponse.schema).getPattern(), expectedPattern); Assert.assertEquals(codegenResponse.pattern, escapedPattern); }