@Test public void enabled() { SpringApplication application = new SpringApplication(Config.class); application.setWebEnvironment(false); Map<String, Object> props = new HashMap<String, Object>(); props.put("spring.output.ansi.enabled", "ALWAYS"); application.setDefaultProperties(props); this.context = application.run(); assertThat(AnsiOutputEnabledValue.get()).isEqualTo(Enabled.ALWAYS); }
@Test public void disabled() throws Exception { SpringApplication application = new SpringApplication(Config.class); application.setWebEnvironment(false); Map<String, Object> props = new HashMap<String, Object>(); props.put("spring.output.ansi.enabled", "never"); application.setDefaultProperties(props); this.context = application.run(); assertThat(AnsiOutputEnabledValue.get()).isEqualTo(Enabled.NEVER); }
@Test public void disabledViaApplicationProperties() throws Exception { ConfigurableEnvironment environment = new StandardEnvironment(); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(environment, "spring.config.name=ansi"); SpringApplication application = new SpringApplication(Config.class); application.setWebEnvironment(false); application.setEnvironment(environment); this.context = application.run(); assertThat(AnsiOutputEnabledValue.get()).isEqualTo(Enabled.NEVER); }
@Test public void enabled() { SpringApplication application = new SpringApplication(Config.class); application.setWebEnvironment(false); Map<String, Object> props = new HashMap<String, Object>(); props.put("spring.output.ansi.enabled", "ALWAYS"); application.setDefaultProperties(props); this.context = application.run(); assertThat(AnsiOutputEnabledValue.get(), equalTo(Enabled.ALWAYS)); }
@Test public void disabled() throws Exception { SpringApplication application = new SpringApplication(Config.class); application.setWebEnvironment(false); Map<String, Object> props = new HashMap<String, Object>(); props.put("spring.output.ansi.enabled", "never"); application.setDefaultProperties(props); this.context = application.run(); assertThat(AnsiOutputEnabledValue.get(), equalTo(Enabled.NEVER)); }
@Test public void disabledViaApplicationProperties() throws Exception { ConfigurableEnvironment environment = new StandardEnvironment(); EnvironmentTestUtils.addEnvironment(environment, "spring.config.name:ansi"); SpringApplication application = new SpringApplication(Config.class); application.setWebEnvironment(false); application.setEnvironment(environment); this.context = application.run(); assertThat(AnsiOutputEnabledValue.get(), equalTo(Enabled.NEVER)); }