### Question:
Collection extends DSpaceObject { public void setMetadata(String field, String value) throws MissingResourceException { if ((field.trim()).equals("name") && (value == null || value.trim().equals(""))) { try { value = I18nUtil.getMessage("org.dspace.workflow.WorkflowManager.untitled"); } catch (MissingResourceException e) { value = "Untitled"; } } if(value == null) { collectionRow.setColumnNull(field); } else { collectionRow.setColumn(field, value.trim()); } modifiedMetadata = true; addDetails(field); } Collection(Context context, TableRow row); static Collection find(Context context, int id); static Collection[] findAll(Context context); ItemIterator getItems(); ItemIterator getAllItems(); int getID(); String getHandle(); String getMetadata(String field); void setMetadata(String field, String value); String getName(); Bitstream getLogo(); Bitstream setLogo(InputStream is); Group createWorkflowGroup(int step); void setWorkflowGroup(int step, Group g); Group getWorkflowGroup(int step); Group createSubmitters(); void removeSubmitters(); Group getSubmitters(); Group createAdministrators(); void removeAdministrators(); Group getAdministrators(); String getLicense(); String getLicenseCollection(); boolean hasCustomLicense(); void setLicense(String license); Item getTemplateItem(); void createTemplateItem(); void removeTemplateItem(); void addItem(Item item); void removeItem(Item item); void update(); boolean canEditBoolean(); boolean canEditBoolean(boolean useInheritance); void canEdit(); void canEdit(boolean useInheritance); Community[] getCommunities(); @Override boolean equals(Object other); @Override int hashCode(); int getType(); static Collection[] findAuthorized(Context context, Community comm,
            int actionID); int countItems(); DSpaceObject getAdminObject(int action); @Override DSpaceObject getParentObject();  }### Answer:
@Test public void testSetMetadata() { String name = "name"; String sdesc = "short description"; String itext = "introductory text"; String logo = "1"; String copy = "copyright declaration"; String sidebar = "side bar text"; String tempItem = "3"; String provDesc = "provenance description"; String license = "license text"; c.setMetadata("name", name); c.setMetadata("short_description", sdesc); c.setMetadata("introductory_text", itext); c.setMetadata("logo_bitstream_id", logo); c.setMetadata("copyright_text", copy); c.setMetadata("side_bar_text", sidebar); c.setMetadata("template_item_id", tempItem); c.setMetadata("provenance_description", provDesc); c.setMetadata("license", license); assertThat("testSetMetadata 0",c.getMetadata("name"), equalTo(name)); assertThat("testSetMetadata 1",c.getMetadata("short_description"), equalTo(sdesc)); assertThat("testSetMetadata 2",c.getMetadata("introductory_text"), equalTo(itext)); assertThat("testSetMetadata 3",c.getMetadata("logo_bitstream_id"), equalTo(logo)); assertThat("testSetMetadata 4",c.getMetadata("copyright_text"), equalTo(copy)); assertThat("testSetMetadata 5",c.getMetadata("side_bar_text"), equalTo(sidebar)); assertThat("testGetMetadata 6",c.getMetadata("template_item_id"), equalTo(tempItem)); assertThat("testGetMetadata 7",c.getMetadata("provenance_description"), equalTo(provDesc)); assertThat("testGetMetadata 8",c.getMetadata("license"), equalTo(license)); }