Item extends DSpaceObject implements DSpaceObjectLegacySupport { public boolean isWithdrawn() { return withdrawn; } protected  Item(); boolean isArchived(); boolean isWithdrawn(); boolean isDiscoverable(); Date getLastModified(); void setLastModified(Date lastModified); void setArchived(boolean isArchived); void setDiscoverable(boolean discoverable); void setOwningCollection(Collection c); Collection getOwningCollection(); EPerson getSubmitter(); void setSubmitter(EPerson sub); List<Collection> getCollections(); void clearCollections(); Collection getTemplateItemOf(); List<Bundle> getBundles(); List<Bundle> getBundles(String name); @Override boolean equals(Object obj); @Override int hashCode(); @Override int getType(); @Override String getName(); @Override Integer getLegacyId(); ItemService getItemService(); static final String ANY; }
@Test public void testWithdrawAuth() throws Exception { new NonStrictExpectations(AuthorizeUtil.class) {{ AuthorizeUtil.authorizeWithdrawItem((Context) any, (Item) any); result = null; }}; new NonStrictExpectations(authorizeService.getClass()) {{ authorizeService.authorizeAction((Context) any, (Item) any, Constants.WRITE); result = null; }}; itemService.withdraw(context, it); assertTrue("testWithdrawAuth 0", it.isWithdrawn()); }
@Test public void testReinstateAuth() throws Exception { new NonStrictExpectations(AuthorizeUtil.class) {{ AuthorizeUtil.authorizeWithdrawItem((Context) any, (Item) any); result = null; AuthorizeUtil.authorizeReinstateItem((Context) any, (Item) any); result = null; }}; new NonStrictExpectations(authorizeService.getClass()) {{ authorizeService.authorizeAction((Context) any, (Item) any, Constants.WRITE); result = null; }}; itemService.withdraw(context, it); itemService.reinstate(context, it); assertFalse("testReinstate 0",it.isWithdrawn()); }