Examples of MergedContextConfiguration


Examples of org.springframework.test.context.MergedContextConfiguration

  @Test
  public void buildMergedConfigWithAnnotationsAndOverriddenLocations() {
    Class<?> testClass = OverriddenLocationsBar.class;
    String[] expectedLocations = new String[] { "/bar.xml" };
    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);

    assertMergedConfig(mergedConfig, testClass, expectedLocations, EMPTY_CLASS_ARRAY,
      AnnotationConfigContextLoader.class);
  }
View Full Code Here

Examples of org.springframework.test.context.MergedContextConfiguration

  @Test
  public void buildMergedConfigWithAnnotationsAndOverriddenClasses() {
    Class<?> testClass = OverriddenClassesBar.class;
    Class<?>[] expectedClasses = new Class<?>[] { BarConfig.class };
    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);

    assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses,
      AnnotationConfigContextLoader.class);
  }
View Full Code Here

Examples of org.springframework.test.context.MergedContextConfiguration

  // --- SmartContextLoader - loadContext() ----------------------------------

  @Test(expected = IllegalArgumentException.class)
  public void loadContextWithNullConfig() throws Exception {
    MergedContextConfiguration mergedConfig = null;
    loader.loadContext(mergedConfig);
  }
View Full Code Here

Examples of org.springframework.test.context.MergedContextConfiguration

  public void loadContextWithoutLocationsAndConfigurationClasses() throws Exception {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage(startsWith("Neither"));
    expectedException.expectMessage(containsString("was able to load an ApplicationContext from"));

    MergedContextConfiguration mergedConfig = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY,
      EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
    loader.loadContext(mergedConfig);
  }
View Full Code Here

Examples of org.springframework.test.context.MergedContextConfiguration

  public void loadContextWithLocationsAndConfigurationClasses() throws Exception {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage(startsWith("Neither"));
    expectedException.expectMessage(endsWith("declare either 'locations' or 'classes' but not both."));

    MergedContextConfiguration mergedConfig = new MergedContextConfiguration(getClass(),
      new String[] { "test.xml" }, new Class[] { getClass() }, EMPTY_STRING_ARRAY, loader);
    loader.loadContext(mergedConfig);
  }
View Full Code Here

Examples of org.springframework.test.context.MergedContextConfiguration

    ((ConfigurableApplicationContext) applicationContext).close();
  }

  @Test
  public void loadContextWithXmlConfig() throws Exception {
    MergedContextConfiguration mergedConfig = new MergedContextConfiguration(
      XmlTestCase.class,
      new String[] { "classpath:/org/springframework/test/context/support/DelegatingSmartContextLoaderTests$XmlTestCase-context.xml" },
      EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
    assertApplicationContextLoadsAndContainsFooString(mergedConfig);
  }
View Full Code Here

Examples of org.springframework.test.context.MergedContextConfiguration

    assertApplicationContextLoadsAndContainsFooString(mergedConfig);
  }

  @Test
  public void loadContextWithConfigurationClass() throws Exception {
    MergedContextConfiguration mergedConfig = new MergedContextConfiguration(ConfigClassTestCase.class,
      EMPTY_STRING_ARRAY, new Class<?>[] { ConfigClassTestCase.Config.class }, EMPTY_STRING_ARRAY, loader);
    assertApplicationContextLoadsAndContainsFooString(mergedConfig);
  }
View Full Code Here

Examples of org.springframework.test.context.MergedContextConfiguration

  private Map<String, Object> getEnvironmentProperties(Class<?> testClass)
      throws Exception {
    TestContext context = new ExposedTestContextManager(testClass)
        .getExposedTestContext();
    new IntegrationTestPropertiesListener().prepareTestInstance(context);
    MergedContextConfiguration config = (MergedContextConfiguration) ReflectionTestUtils
        .getField(context, "mergedContextConfiguration");
    return this.loader.extractEnvironmentProperties(config
        .getPropertySourceProperties());
  }
View Full Code Here

Examples of org.springframework.test.context.MergedContextConfiguration

    }
  }

  private void addPropertySourcePropertiesUsingReflection(TestContext testContext,
      String[] properties) throws Exception {
    MergedContextConfiguration configuration = (MergedContextConfiguration) ReflectionTestUtils
        .getField(testContext, "mergedContextConfiguration");
    Set<String> merged = new LinkedHashSet<String>((Arrays.asList(configuration
        .getPropertySourceProperties())));
    merged.addAll(Arrays.asList(properties));
    addIntegrationTestProperty(merged);
    ReflectionTestUtils.setField(configuration, "propertySourceProperties",
        merged.toArray(new String[merged.size()]));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.