StsTestUtil.waitForResource(resource);
}
@Test
public void testRequiredAnnotationConfiguration() throws Exception {
IBean bean = BeansModelUtils.getBean("abstractFoo", beansConfig);
assertNotNull(bean);
int severity = MarkerUtils.getHighestSeverityFromMarkersInRange(resource, bean
.getElementStartLine(), bean.getElementEndLine());
assertEquals("Abstract beans are not required to be configured", -1, severity);
bean = BeansModelUtils.getBean("goodFoo", beansConfig);
severity = MarkerUtils.getHighestSeverityFromMarkersInRange(resource, bean
.getElementStartLine(), bean.getElementEndLine());
assertEquals("Satisfying configuration given; no error expected", -1, severity);
bean = BeansModelUtils.getBean("wrongFoo", beansConfig);
severity = MarkerUtils.getHighestSeverityFromMarkersInRange(resource, bean
.getElementStartLine(), bean.getElementEndLine());
assertEquals("Missing required configuration; error expected", IMarker.SEVERITY_WARNING,
severity);
Set<IMarker> markers = MarkerUtils.getAllMarkersInRange(resource, bean
.getElementStartLine(), bean.getElementEndLine());
assertEquals(1, markers.size());
for (IMarker marker : markers) {
String msg = (String) marker.getAttribute(IMarker.MESSAGE);
assertEquals("Error message not expected '" + msg + "'",
"Property 'bar' is required for bean 'wrongFoo'", msg);