MetadataField implements ReloadableEntity<Integer> { public Integer getID() { return id; } protected  MetadataField(); Integer getID(); String getElement(); void setElement(String element); String getQualifier(); void setQualifier(String qualifier); String getScopeNote(); void setScopeNote(String scopeNote); MetadataSchema getMetadataSchema(); void setMetadataSchema(MetadataSchema metadataSchema); @Override boolean equals(Object obj); @Override int hashCode(); String toString(char separator); @Override String toString();  }
@Test public void testGetFieldID() { assertTrue("testGetFieldID 0",mf.getID() >= 0); }
@Test public void testCreateAuth() throws Exception { new NonStrictExpectations(authorizeService.getClass()) {{ authorizeService.isAdmin(context); result = true; }}; String elem = "elem1"; String qual = "qual1"; MetadataField m = metadataFieldService.create(context, dcSchema, elem, qual, null); MetadataField found = metadataFieldService.findByElement(context, dcSchema, elem, qual); assertThat("testCreateAuth 0",found.getID(), equalTo(m.getID())); }
@Test public void testUpdateAuth() throws Exception { new NonStrictExpectations(authorizeService.getClass()) {{ authorizeService.isAdmin(context); result = true; }}; String elem = "elem2"; String qual = "qual2"; MetadataField m = metadataFieldService.create(context, dcSchema, elem, qual, null); metadataFieldService.update(context, m); MetadataField found = metadataFieldService.findByElement(context, MetadataSchema.DC_SCHEMA, elem, qual); assertThat("testUpdateAuth 0",found.getID(), equalTo(m.getID())); }
@Test public void testFind() throws Exception { int id = mf.getID(); MetadataField found = metadataFieldService.find(context, id); assertThat("testFind 0",found, notNullValue()); assertThat("testFind 1",found.getID(), equalTo(mf.getID())); }