Junit/Groovy Expected Exception
@Test
@ExpectedException (NoLockFoundException)
public void testGetLockInfo_Throws_Exception() {
def mockContentDao = [
loadActiveContentInfoByArtifactUuid: { artifactUuid ->
ContentInfo contentInfo = new ContentInfo(artifactUuid)
contentInfo
}
] as ContentInfoDao
ContentService contentService = new ContentServiceImpl()
contentService. contentInfoDao = mockContentDao
try{
contentService.getLockInfo("I00000000000000000000000000000000" )
} catch (NoLockFoundException){}
}