@Test public void shouldUseCustomConfigFileIfProvided() throws IOException, ServletException { givenThisConfiguration("{\n" + " \"modelPackages\": [\"com.github.valdr.model.b\"],\n" + " \"corsAllowOriginPattern\": \"abc.com\"\n" + "}"); servlet.init(servletConfig); assertThat(ReflectionTestUtils.getField(servlet, "correctlyConfigured").toString(), is("true")); assertThat(ReflectionTestUtils.getField(servlet, "corsAllowOriginPattern").toString(), is("abc.com")); }
@Override public void init(ServletConfig config) throws ServletException { super.init(config); Options options = loadOptions(); invalidConfigurationMessage = validate(options); correctlyConfigured = StringUtils.isEmpty(invalidConfigurationMessage); corsAllowOriginPattern = options.getCorsAllowOriginPattern(); parser = new ConstraintParser(options); logConfigurationStatus(); logCorsStatus(); }
ValidationRulesServlet extends HttpServlet { @Override public void init(ServletConfig config) throws ServletException { super.init(config); Options options = loadOptions(); invalidConfigurationMessage = validate(options); correctlyConfigured = StringUtils.isEmpty(invalidConfigurationMessage); corsAllowOriginPattern = options.getCorsAllowOriginPattern(); parser = new ConstraintParser(options); logConfigurationStatus(); logCorsStatus(); } }
ValidationRulesServlet extends HttpServlet { @Override public void init(ServletConfig config) throws ServletException { super.init(config); Options options = loadOptions(); invalidConfigurationMessage = validate(options); correctlyConfigured = StringUtils.isEmpty(invalidConfigurationMessage); corsAllowOriginPattern = options.getCorsAllowOriginPattern(); parser = new ConstraintParser(options); logConfigurationStatus(); logCorsStatus(); }  }
ValidationRulesServlet extends HttpServlet { @Override public void init(ServletConfig config) throws ServletException { super.init(config); Options options = loadOptions(); invalidConfigurationMessage = validate(options); correctlyConfigured = StringUtils.isEmpty(invalidConfigurationMessage); corsAllowOriginPattern = options.getCorsAllowOriginPattern(); parser = new ConstraintParser(options); logConfigurationStatus(); logCorsStatus(); }  @Override void init(ServletConfig config); }
ValidationRulesServlet extends HttpServlet { @Override public void init(ServletConfig config) throws ServletException { super.init(config); Options options = loadOptions(); invalidConfigurationMessage = validate(options); correctlyConfigured = StringUtils.isEmpty(invalidConfigurationMessage); corsAllowOriginPattern = options.getCorsAllowOriginPattern(); parser = new ConstraintParser(options); logConfigurationStatus(); logCorsStatus(); }  @Override void init(ServletConfig config);  }