/** * Determine if this {@code MergedContextConfiguration} instance has * either path-based context resource locations or class-based resources. * @return {@code true} if either the {@link #getLocations() locations} * or the {@link #getClasses() classes} array is not empty * @since 4.0.4 * @see #hasLocations() * @see #hasClasses() */ public boolean hasResources() { return (hasLocations() || hasClasses()); }
private boolean supports(SmartContextLoader loader, MergedContextConfiguration mergedConfig) { if (loader == getAnnotationConfigLoader()) { return (mergedConfig.hasClasses() && !mergedConfig.hasLocations()); } else { return (mergedConfig.hasLocations() && !mergedConfig.hasClasses()); } }
/** * Ensure that the supplied {@link MergedContextConfiguration} does not * contain {@link MergedContextConfiguration#getClasses() classes}. * @since 4.0.4 * @see AbstractGenericContextLoader#validateMergedContextConfiguration */ @Override protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) { if (mergedConfig.hasClasses()) { String msg = String.format( "Test class [%s] has been configured with @ContextConfiguration's 'classes' attribute %s, " + "but %s does not support annotated classes.", mergedConfig.getTestClass().getName(), ObjectUtils.nullSafeToString(mergedConfig.getClasses()), getClass().getSimpleName()); logger.error(msg); throw new IllegalStateException(msg); } }
/** * Ensure that the supplied {@link MergedContextConfiguration} does not * contain {@link MergedContextConfiguration#getClasses() classes}. * @since 4.0.4 * @see AbstractGenericContextLoader#validateMergedContextConfiguration */ @Override protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) { if (mergedConfig.hasClasses()) { String msg = String.format( "Test class [%s] has been configured with @ContextConfiguration's 'classes' attribute %s, " + "but %s does not support annotated classes.", mergedConfig.getTestClass().getName(), ObjectUtils.nullSafeToString(mergedConfig.getClasses()), getClass().getSimpleName()); logger.error(msg); throw new IllegalStateException(msg); } }
@Override protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) { Assert.isTrue(mergedConfig.hasClasses() || mergedConfig.hasLocations(), getClass().getSimpleName() + " requires either classes or locations"); }
Assert.notNull(mergedConfig, "MergedContextConfiguration must not be null"); Assert.state(!(mergedConfig.hasLocations() && mergedConfig.hasClasses()), () -> String.format( "Neither %s nor %s supports loading an ApplicationContext from %s: " + "declare either 'locations' or 'classes' but not both.", name(getXmlLoader()),
/** * Determine if this {@code MergedContextConfiguration} instance has * either path-based context resource locations or class-based resources. * @return {@code true} if either the {@link #getLocations() locations} * or the {@link #getClasses() classes} array is not empty * @since 4.0.4 * @see #hasLocations() * @see #hasClasses() */ public boolean hasResources() { return (hasLocations() || hasClasses()); }
/** * Determine if this {@code MergedContextConfiguration} instance has * either path-based context resource locations or class-based resources. * @return {@code true} if either the {@link #getLocations() locations} * or the {@link #getClasses() classes} array is not empty * @since 4.0.4 * @see #hasLocations() * @see #hasClasses() */ public boolean hasResources() { return (hasLocations() || hasClasses()); }
private boolean supports(SmartContextLoader loader, MergedContextConfiguration mergedConfig) { if (loader == getAnnotationConfigLoader()) { return (mergedConfig.hasClasses() && !mergedConfig.hasLocations()); } else { return (mergedConfig.hasLocations() && !mergedConfig.hasClasses()); } }
private boolean supports(SmartContextLoader loader, MergedContextConfiguration mergedConfig) { if (loader == getAnnotationConfigLoader()) { return (mergedConfig.hasClasses() && !mergedConfig.hasLocations()); } else { return (mergedConfig.hasLocations() && !mergedConfig.hasClasses()); } }
/** * Ensure that the supplied {@link MergedContextConfiguration} does not * contain {@link MergedContextConfiguration#getClasses() classes}. * @since 4.0.4 * @see AbstractGenericContextLoader#validateMergedContextConfiguration */ @Override protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) { if (mergedConfig.hasClasses()) { String msg = String.format( "Test class [%s] has been configured with @ContextConfiguration's 'classes' attribute %s, " + "but %s does not support annotated classes.", mergedConfig.getTestClass().getName(), ObjectUtils.nullSafeToString(mergedConfig.getClasses()), getClass().getSimpleName()); logger.error(msg); throw new IllegalStateException(msg); } }
/** * Ensure that the supplied {@link MergedContextConfiguration} does not * contain {@link MergedContextConfiguration#getClasses() classes}. * @since 4.0.4 * @see AbstractGenericContextLoader#validateMergedContextConfiguration */ @Override protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) { if (mergedConfig.hasClasses()) { String msg = String.format( "Test class [%s] has been configured with @ContextConfiguration's 'classes' attribute %s, " + "but %s does not support annotated classes.", mergedConfig.getTestClass().getName(), ObjectUtils.nullSafeToString(mergedConfig.getClasses()), getClass().getSimpleName()); logger.error(msg); throw new IllegalStateException(msg); } }
/** * Ensure that the supplied {@link MergedContextConfiguration} does not * contain {@link MergedContextConfiguration#getClasses() classes}. * @since 4.0.4 * @see AbstractGenericContextLoader#validateMergedContextConfiguration */ @Override protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) { if (mergedConfig.hasClasses()) { String msg = String.format( "Test class [%s] has been configured with @ContextConfiguration's 'classes' attribute %s, " + "but %s does not support annotated classes.", mergedConfig.getTestClass().getName(), ObjectUtils.nullSafeToString(mergedConfig.getClasses()), getClass().getSimpleName()); logger.error(msg); throw new IllegalStateException(msg); } }
/** * Ensure that the supplied {@link MergedContextConfiguration} does not * contain {@link MergedContextConfiguration#getClasses() classes}. * @since 4.0.4 * @see AbstractGenericContextLoader#validateMergedContextConfiguration */ @Override protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) { if (mergedConfig.hasClasses()) { String msg = String.format( "Test class [%s] has been configured with @ContextConfiguration's 'classes' attribute %s, " + "but %s does not support annotated classes.", mergedConfig.getTestClass().getName(), ObjectUtils.nullSafeToString(mergedConfig.getClasses()), getClass().getSimpleName()); logger.error(msg); throw new IllegalStateException(msg); } }
Assert.notNull(mergedConfig, "MergedContextConfiguration must not be null"); Assert.state(!(mergedConfig.hasLocations() && mergedConfig.hasClasses()), () -> String.format( "Neither %s nor %s supports loading an ApplicationContext from %s: " + "declare either 'locations' or 'classes' but not both.", name(getXmlLoader()),
Assert.notNull(mergedConfig, "MergedContextConfiguration must not be null"); if (mergedConfig.hasLocations() && mergedConfig.hasClasses()) { throw new IllegalStateException(String.format( "Neither %s nor %s supports loading an ApplicationContext from %s: " +