public void testModifySpecifiedName() throws Exception { createTestEntityWithElementCollection(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); JavaElementCollectionMapping2_0 elementCollectionMapping = (JavaElementCollectionMapping2_0) getJavaPersistentType().getAttributes().iterator().next().getMapping(); CollectionTable2_0 collectionTable = elementCollectionMapping.getCollectionTable(); JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, AstNodeType.TYPE); JavaResourceField resourceField = resourceType.getFields().iterator().next(); CollectionTableAnnotation2_0 resourceCollectionTable3 = (CollectionTableAnnotation2_0) resourceField.getAnnotation(CollectionTableAnnotation2_0.ANNOTATION_NAME); assertNull(collectionTable.getSpecifiedName()); assertNull(resourceCollectionTable3); // set name in the context model, verify resource model modified collectionTable.setSpecifiedName("foo"); resourceCollectionTable3 = (CollectionTableAnnotation2_0) resourceField.getAnnotation(CollectionTableAnnotation2_0.ANNOTATION_NAME); assertEquals("foo", collectionTable.getSpecifiedName()); assertEquals("foo", resourceCollectionTable3.getName()); // set name to null in the context model collectionTable.setSpecifiedName(null); assertNull(collectionTable.getSpecifiedName()); assertNull(resourceField.getAnnotation(CollectionTableAnnotation2_0.ANNOTATION_NAME)); }