mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Check exception messages
This commit is contained in:
@@ -57,7 +57,7 @@ public class UpdateHeldActiveContentTest extends BaseRMTestCase
|
|||||||
*/
|
*/
|
||||||
public void testDeleteHeldDocument()
|
public void testDeleteHeldDocument()
|
||||||
{
|
{
|
||||||
doBehaviourDrivenTest(new BehaviourDrivenTest(PermissionDeniedException.class)
|
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||||
{
|
{
|
||||||
public void given()
|
public void given()
|
||||||
{
|
{
|
||||||
@@ -69,8 +69,16 @@ public class UpdateHeldActiveContentTest extends BaseRMTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void when()
|
public void when()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
fileFolderService.delete(dmDocument);
|
fileFolderService.delete(dmDocument);
|
||||||
|
fail("Expected PermissionDeniedException to be thrown");
|
||||||
|
}
|
||||||
|
catch (PermissionDeniedException pde)
|
||||||
|
{
|
||||||
|
assertTrue(pde.getMessage().contains("Frozen nodes can not be deleted."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -107,7 +115,7 @@ public class UpdateHeldActiveContentTest extends BaseRMTestCase
|
|||||||
*/
|
*/
|
||||||
public void testMoveHeldDocument()
|
public void testMoveHeldDocument()
|
||||||
{
|
{
|
||||||
doBehaviourDrivenTest(new BehaviourDrivenTest(PermissionDeniedException.class)
|
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||||
{
|
{
|
||||||
public void given()
|
public void given()
|
||||||
{
|
{
|
||||||
@@ -119,8 +127,16 @@ public class UpdateHeldActiveContentTest extends BaseRMTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void when() throws FileNotFoundException
|
public void when() throws FileNotFoundException
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
fileFolderService.move(dmDocument, dmFolder1, null);
|
fileFolderService.move(dmDocument, dmFolder1, null);
|
||||||
|
fail("Expected PermissionDeniedException to be thrown");
|
||||||
|
}
|
||||||
|
catch (PermissionDeniedException pde)
|
||||||
|
{
|
||||||
|
assertTrue(pde.getMessage().contains("Frozen nodes can not be moved."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -133,7 +149,7 @@ public class UpdateHeldActiveContentTest extends BaseRMTestCase
|
|||||||
*/
|
*/
|
||||||
public void testUpdateHeldDocumentProperties()
|
public void testUpdateHeldDocumentProperties()
|
||||||
{
|
{
|
||||||
doBehaviourDrivenTest(new BehaviourDrivenTest(PermissionDeniedException.class)
|
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||||
{
|
{
|
||||||
public void given()
|
public void given()
|
||||||
{
|
{
|
||||||
@@ -145,8 +161,16 @@ public class UpdateHeldActiveContentTest extends BaseRMTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void when()
|
public void when()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
nodeService.setProperty(dmDocument, ContentModel.PROP_DESCRIPTION, "description");
|
nodeService.setProperty(dmDocument, ContentModel.PROP_DESCRIPTION, "description");
|
||||||
|
fail("Expected PermissionDeniedException to be thrown");
|
||||||
|
}
|
||||||
|
catch (PermissionDeniedException pde)
|
||||||
|
{
|
||||||
|
assertTrue(pde.getMessage().contains("Frozen nodes can not be updated."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -158,7 +182,7 @@ public class UpdateHeldActiveContentTest extends BaseRMTestCase
|
|||||||
*/
|
*/
|
||||||
public void testUpdateHeldDocumentContent()
|
public void testUpdateHeldDocumentContent()
|
||||||
{
|
{
|
||||||
doBehaviourDrivenTest(new BehaviourDrivenTest(PermissionDeniedException.class)
|
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||||
{
|
{
|
||||||
public void given()
|
public void given()
|
||||||
{
|
{
|
||||||
@@ -170,10 +194,18 @@ public class UpdateHeldActiveContentTest extends BaseRMTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void when()
|
public void when()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
ContentData content = (ContentData) nodeService.getProperty(dmDocument, PROP_CONTENT);
|
ContentData content = (ContentData) nodeService.getProperty(dmDocument, PROP_CONTENT);
|
||||||
nodeService.setProperty(dmDocument, PROP_CONTENT, ContentData.setMimetype(content,
|
nodeService.setProperty(dmDocument, PROP_CONTENT, ContentData.setMimetype(content,
|
||||||
MimetypeMap.MIMETYPE_TEXT_PLAIN));
|
MimetypeMap.MIMETYPE_TEXT_PLAIN));
|
||||||
|
fail("Expected PermissionDeniedException to be thrown");
|
||||||
|
}
|
||||||
|
catch (PermissionDeniedException pde)
|
||||||
|
{
|
||||||
|
assertTrue(pde.getMessage().contains("Frozen nodes can not be updated."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user