Package org.springframework.core.env

Examples of org.springframework.core.env.AbstractEnvironment


    environment.acceptsProfiles("p1", "!");
  }

  @Test
  public void environmentSubclass_withCustomProfileValidation() {
    ConfigurableEnvironment env = new AbstractEnvironment() {
      @Override
      protected void validateProfile(String profile) {
        super.validateProfile(profile);
        if (profile.contains("-")) {
          throw new IllegalArgumentException(
              "Invalid profile [" + profile + "]: must not contain dash character");
        }
      }
    };

    env.addActiveProfile("validProfile"); // succeeds

    try {
      env.addActiveProfile("invalid-profile");
      fail("expected validation exception");
    }
    catch (IllegalArgumentException ex) {
      assertThat(ex.getMessage(),
          equalTo("Invalid profile [invalid-profile]: must not contain dash character"));
View Full Code Here


  private static final Random random = new Random();

  @Test
  public void testLegitOptionResolution() {
    ConfigurableEnvironment parentEnv = new AbstractEnvironment() {

      @Override
      protected void customizePropertySources(MutablePropertySources propertySources) {
        propertySources.addFirst(singleton("user", "eric"));
      }
View Full Code Here

  }

  @Test
  public void testIllegalOptionResolution() {
    ConfigurableEnvironment parentEnv = new AbstractEnvironment() {

      @Override
      protected void customizePropertySources(MutablePropertySources propertySources) {
        propertySources.addFirst(singleton("user", "eric"));
      }
View Full Code Here

TOP

Related Classes of org.springframework.core.env.AbstractEnvironment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.