String[] titles = item.getDC("title", null, LANG);
DCValue[] titles = item.getDC("title", null, LANG);
    public void testItemDCValues()    {        Context context = null;        List TITLES = Arrays.asList( new String[] {            "Test Title",            "Warehouse Songs and Stories",            "Rainbow Soup"        });        List ALTERNATIVE_TITLES = Arrays.asList( new String[] {            "Test Title 2",            "Being and Nothingness",            "Jungle Book",            "Perls before Swine"        });        String LANG = "en";        String now = new DCDate(new java.util.Date()).toString();        try        {            context = new Context();            Community community = Community.create(context);            Collection collection = community.createCollection();            WorkspaceItem wi = WorkspaceItem.create(context, collection, null);            int w_id = wi.getID();            Item item = wi.getItem();            int id = item.getID();            // Add some DC fields            item.addDC("title", null, LANG,                       toStringArray(TITLES));            item.addDC("title", null, LANG,                       (String) TITLES.get(0));            item.addDC("title", "alternative", LANG,                       toStringArray(ALTERNATIVE_TITLES));            item.addDC("date","accessioned", null, now);            item.update();            // FIXME: Start a new transaction - this is a workaround for            // a PostgreSQL 7.1 bug.            context.complete();            context = new Context();            item = Item.find(context, id);            // Retrieve titles            String[] titles = item.getDC("title", null, LANG);            assertNotNull("Retrieved titles", titles);            assertEquals("Got correct number of titles",                         titles.length,                         TITLES.size() + 1);            assertTrue("Got correct titles",                       containsAll(titles, TITLES));            // Retrieve alternative titles            String[] alt = item.getDC("title", "alternative", LANG);            assertNotNull("Retrieved titles", alt);            assertEquals("Got correct number of titles",                         alt.length,                         ALTERNATIVE_TITLES.size());            assertTrue("Got correct titles",                       containsAll(alt, ALTERNATIVE_TITLES));            // Retrieve dates            String[] dates = item.getDC("date", "accessioned", null);            assertNotNull("Retrieved dates", dates);            assertEquals("Got correct number of dates",                         dates.length, 1);            assertEquals("Got correct date", now, dates[0]);            // Retrieve wildcard            String[] all = item.getDC(Item.ANY, Item.ANY, Item.ANY);            assertNotNull("Got values", all);            assertEquals("Got correct number of values",                         all.length,                         TITLES.size() + ALTERNATIVE_TITLES.size() + 1 + 1);            // Retrieve wildcarded titles            String[] all_titles = item.getDC("title", Item.ANY, Item.ANY);            assertNotNull("Got values", all_titles);            assertEquals("Got correct number of values",                         all_titles.length,                         TITLES.size() + ALTERNATIVE_TITLES.size() + 1);            // Clear just the alternative title            item.clearDC("title", "alternative", LANG);            alt = item.getDC("title", "alternative", LANG);            assertNotNull("Retrieved titles", alt);            assertEquals("Got correct number of titles",                         alt.length, 0);            wi = WorkspaceItem.find(context, w_id);            wi.delete();            assertNull("Item cannot be found after deletion",                       Item.find(context, id));            context.abort();        }        // Clean up context or the test hangs        catch (AssertionFailedError afe)        {            if (context != null)                context.abort();            throw afe;        }        catch (Exception e)        {            if (context != null)                context.abort();            e.printStackTrace();            System.out.println("Got exception: " + e);            fail("Exception while running test: " + e);        }    }