org.springframework.core.annotation.AnnotationConfigurationException Java Examples

The following examples show how to use org.springframework.core.annotation.AnnotationConfigurationException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SqlScriptsTestExecutionListenerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void valueAndScriptsDeclared() throws Exception {
	Class<?> clazz = ValueAndScriptsDeclared.class;
	BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz);
	given(testContext.getTestMethod()).willReturn(clazz.getDeclaredMethod("foo"));

	assertThatExceptionOfType(AnnotationConfigurationException.class).isThrownBy(() ->
			listener.beforeTestMethod(testContext))
		.withMessageContaining("Different @AliasFor mirror values")
		.withMessageContaining("attribute 'scripts' and its alias 'value'")
		.withMessageContaining("values of [{bar}] and [{foo}]");
}
 
Example #2
Source File: ContextLoaderUtilsConfigurationAttributesTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void resolveConfigAttributesWithConflictingLocations() {
	assertThatExceptionOfType(AnnotationConfigurationException.class).isThrownBy(() ->
			resolveContextConfigurationAttributes(ConflictingLocations.class))
		.withMessageStartingWith("Different @AliasFor mirror values")
		.withMessageContaining(ConflictingLocations.class.getName())
		.withMessageContaining("attribute 'locations' and its alias 'value'")
		.withMessageContaining("values of [{y}] and [{x}]");
}
 
Example #3
Source File: SqlScriptsTestExecutionListenerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void valueAndScriptsDeclared() throws Exception {
	Class<?> clazz = ValueAndScriptsDeclared.class;
	BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz);
	given(testContext.getTestMethod()).willReturn(clazz.getDeclaredMethod("foo"));

	exception.expect(AnnotationConfigurationException.class);
	exception.expectMessage(either(
			containsString("attribute 'value' and its alias 'scripts'")).or(
			containsString("attribute 'scripts' and its alias 'value'")));
	exception.expectMessage(either(containsString("values of [{foo}] and [{bar}]")).or(
			containsString("values of [{bar}] and [{foo}]")));
	exception.expectMessage(containsString("but only one is permitted"));
	listener.beforeTestMethod(testContext);
}
 
Example #4
Source File: ContextLoaderUtilsConfigurationAttributesTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void resolveConfigAttributesWithConflictingLocations() {
	exception.expect(AnnotationConfigurationException.class);
	exception.expectMessage(containsString(ConflictingLocations.class.getName()));
	exception.expectMessage(either(
			containsString("attribute 'value' and its alias 'locations'")).or(
			containsString("attribute 'locations' and its alias 'value'")));
	exception.expectMessage(either(
			containsString("values of [{x}] and [{y}]")).or(
			containsString("values of [{y}] and [{x}]")));
	exception.expectMessage(containsString("but only one is permitted"));
	resolveContextConfigurationAttributes(ConflictingLocations.class);
}
 
Example #5
Source File: SqlScriptsTestExecutionListenerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void valueAndScriptsDeclared() throws Exception {
	Class<?> clazz = ValueAndScriptsDeclared.class;
	BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz);
	given(testContext.getTestMethod()).willReturn(clazz.getDeclaredMethod("foo"));

	exception.expect(AnnotationConfigurationException.class);
	exception.expectMessage(either(
			containsString("attribute 'value' and its alias 'scripts'")).or(
			containsString("attribute 'scripts' and its alias 'value'")));
	exception.expectMessage(either(containsString("values of [{foo}] and [{bar}]")).or(
			containsString("values of [{bar}] and [{foo}]")));
	exception.expectMessage(containsString("but only one is permitted"));
	listener.beforeTestMethod(testContext);
}
 
Example #6
Source File: ContextLoaderUtilsConfigurationAttributesTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void resolveConfigAttributesWithConflictingLocations() {
	exception.expect(AnnotationConfigurationException.class);
	exception.expectMessage(containsString(ConflictingLocations.class.getName()));
	exception.expectMessage(either(
			containsString("attribute 'value' and its alias 'locations'")).or(
			containsString("attribute 'locations' and its alias 'value'")));
	exception.expectMessage(either(
			containsString("values of [{x}] and [{y}]")).or(
			containsString("values of [{y}] and [{x}]")));
	exception.expectMessage(containsString("but only one is permitted"));
	resolveContextConfigurationAttributes(ConflictingLocations.class);
}
 
Example #7
Source File: TestExecutionListenersTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test(expected = AnnotationConfigurationException.class)
public void listenersAndValueAttributesDeclared() {
	new TestContextManager(DuplicateListenersConfigTestCase.class);
}
 
Example #8
Source File: ActiveProfilesUtilsTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * @since 4.0
 */
@Test(expected = AnnotationConfigurationException.class)
public void resolveActiveProfilesWithConflictingProfilesAndValue() {
	resolveActiveProfiles(ConflictingProfilesAndValueTestCase.class);
}
 
Example #9
Source File: TestPropertySourceUtilsTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test
public void locationsAndValueAttributes() {
	assertThatExceptionOfType(AnnotationConfigurationException.class).isThrownBy(() ->
			buildMergedTestPropertySources(LocationsAndValuePropertySources.class));
}
 
Example #10
Source File: TestExecutionListenersTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test(expected = AnnotationConfigurationException.class)
public void listenersAndValueAttributesDeclared() {
	new TestContextManager(DuplicateListenersConfigTestCase.class);
}
 
Example #11
Source File: ActiveProfilesUtilsTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * @since 4.0
 */
@Test(expected = AnnotationConfigurationException.class)
public void resolveActiveProfilesWithConflictingProfilesAndValue() {
	resolveActiveProfiles(ConflictingProfilesAndValueTestCase.class);
}
 
Example #12
Source File: TestPropertySourceUtilsTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
public void locationsAndValueAttributes() {
	expectedException.expect(AnnotationConfigurationException.class);
	buildMergedTestPropertySources(LocationsAndValuePropertySources.class);
}
 
Example #13
Source File: TestExecutionListenersTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Test(expected = AnnotationConfigurationException.class)
public void listenersAndValueAttributesDeclared() {
	new TestContextManager(DuplicateListenersConfigTestCase.class);
}
 
Example #14
Source File: ActiveProfilesUtilsTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * @since 4.0
 */
@Test(expected = AnnotationConfigurationException.class)
public void resolveActiveProfilesWithConflictingProfilesAndValue() {
	resolveActiveProfiles(ConflictingProfilesAndValueTestCase.class);
}
 
Example #15
Source File: TestPropertySourceUtilsTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Test
public void locationsAndValueAttributes() {
	expectedException.expect(AnnotationConfigurationException.class);
	buildMergedTestPropertySources(LocationsAndValuePropertySources.class);
}