public static Collection<IMedia> findReferencedMedia()
      throws MapperException, XPathExpressionException, SQLException {
    Set<IMedia> referenced = new HashSet<IMedia>();

    //		// TODO: obviously maintaining this list is not the way to go
    //		// I would like to have it so the structure clearly differentiates between an ID declaration
    // and
    //		// a reference to an object's id
    //		// something along the lines of <Snu><mainMedia><refId>1</refId></mainMedia></Snu>
    for (String ELEMENT : MapperHelper.REFERENCING_ELEMENTS) {
      NodeList elements = DataRegistry.getDocument().getElementsByTagName(ELEMENT);
      int length = elements.getLength();
      for (int i = 0; i < length; ++i) {
        Element element = (Element) elements.item(i);
        long refId = Long.parseLong(element.getTextContent());
        try {
          IResource resource = ResourceInputMapper.map(refId);
          if (resource instanceof IMedia) referenced.add((IMedia) resource);
        } catch (DomainObjectNotFoundException e) {
          e = null;
        }
      }
    }
    return referenced;
  }
 @Override
 @Before
 public void setUp() throws Exception {
   super.setUp();
   DomainTestUtil.setupDataRegistry(DataRegistry.getFile(), DataRegistry.createDefaultDocument());
 }