default repository manager should throw RepositoryNotFoundException

This commit is contained in:
Sebastian Sdorra
2013-01-29 20:26:38 +01:00
parent 1e7ff1a71a
commit a5c24f54d5
2 changed files with 55 additions and 15 deletions

View File

@@ -103,6 +103,19 @@ public abstract class RepositoryManagerTestBase
assertNull(manager.get(id));
}
/**
* Method description
*
*
* @throws IOException
* @throws RepositoryException
*/
@Test(expected = RepositoryNotFoundException.class)
public void testDeleteNotFound() throws RepositoryException, IOException
{
manager.delete(createRepositoryWithId());
}
/**
* Method description
*
@@ -156,8 +169,8 @@ public abstract class RepositoryManagerTestBase
foundHeart = true;
heartReference = repository;
}
else if (repository.getId().equals(
happyVerticalPeopleTransporter.getId()))
else if (
repository.getId().equals(happyVerticalPeopleTransporter.getId()))
{
assertRepositoriesEquals(happyVerticalPeopleTransporter, repository);
foundTransporter = true;
@@ -202,10 +215,10 @@ public abstract class RepositoryManagerTestBase
* @throws IOException
* @throws RepositoryException
*/
@Test(expected = RepositoryException.class)
public void testModifyNotExisting() throws RepositoryException, IOException
@Test(expected = RepositoryNotFoundException.class)
public void testModifyNotFound() throws RepositoryException, IOException
{
manager.modify(RepositoryTestData.createHeartOfGold());
manager.modify(createRepositoryWithId());
}
/**
@@ -226,6 +239,19 @@ public abstract class RepositoryManagerTestBase
assertEquals(description, heartOfGold.getDescription());
}
/**
* Method description
*
*
* @throws IOException
* @throws RepositoryException
*/
@Test(expected = RepositoryNotFoundException.class)
public void testRefreshNotFound() throws RepositoryException, IOException
{
manager.refresh(createRepositoryWithId());
}
/**
* Method description
*
@@ -265,6 +291,21 @@ public abstract class RepositoryManagerTestBase
return repository;
}
/**
* Method description
*
*
* @return
*/
private Repository createRepositoryWithId()
{
Repository repository = RepositoryTestData.createHeartOfGold();
repository.setId("abc");
return repository;
}
/**
* Method description
*

View File

@@ -104,7 +104,6 @@ public class DefaultRepositoryManager extends AbstractRepositoryManager
* @param configuration
* @param contextProvider
* @param keyGenerator
* @param securityContextProvider
* @param repositoryDAO
* @param handlerSet
* @param repositoryListenersProvider
@@ -253,7 +252,7 @@ public class DefaultRepositoryManager extends AbstractRepositoryManager
}
else
{
throw new RepositoryException(
throw new RepositoryNotFoundException(
"repository ".concat(repository.getName()).concat(" not found"));
}
@@ -381,7 +380,7 @@ public class DefaultRepositoryManager extends AbstractRepositoryManager
}
else
{
throw new RepositoryException(
throw new RepositoryNotFoundException(
"repository ".concat(repository.getName()).concat(" not found"));
}
@@ -413,7 +412,7 @@ public class DefaultRepositoryManager extends AbstractRepositoryManager
}
else
{
throw new RepositoryException(
throw new RepositoryNotFoundException(
"repository ".concat(repository.getName()).concat(" not found"));
}
}