ConfigureBeans { @Bean public FilterConfiguration ebayCrossDomain(){ return new FilterConfiguration() { @Override public String getName() { return "ebay-cors"; } @Override public String[] getMapping() { if(!simple) return new String[] {mapping }; else return new String[0]; } @Override public Map<String, String> getInitParameters() { return Optional.ofNullable(initParameters).orElse(new HashMap<>()); } @Override public Either<Class<? extends Filter>, Filter> getFilter() { return Either.left( org.ebaysf.web.cors.CORSFilter.class); } }; }  @Bean FilterConfiguration crossDomain(); @Bean FilterConfiguration ebayCrossDomain();  }
@Test public void testEbayCrossDomainOn() { ConfigureBeans config = new ConfigureBeans(false,"/*",new HashMap<>()); assertThat(config.ebayCrossDomain().getMapping().length,equalTo(1)); }
@Test public void testEbayCrossDomainOff() { ConfigureBeans config = new ConfigureBeans(true,"/*",new HashMap<>()); assertThat(config.ebayCrossDomain().getMapping().length,equalTo(0)); }