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)); 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 * Method description
* *
@@ -156,8 +169,8 @@ public abstract class RepositoryManagerTestBase
foundHeart = true; foundHeart = true;
heartReference = repository; heartReference = repository;
} }
else if (repository.getId().equals( else if (
happyVerticalPeopleTransporter.getId())) repository.getId().equals(happyVerticalPeopleTransporter.getId()))
{ {
assertRepositoriesEquals(happyVerticalPeopleTransporter, repository); assertRepositoriesEquals(happyVerticalPeopleTransporter, repository);
foundTransporter = true; foundTransporter = true;
@@ -202,10 +215,10 @@ public abstract class RepositoryManagerTestBase
* @throws IOException * @throws IOException
* @throws RepositoryException * @throws RepositoryException
*/ */
@Test(expected = RepositoryException.class) @Test(expected = RepositoryNotFoundException.class)
public void testModifyNotExisting() throws RepositoryException, IOException 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()); 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 * Method description
* *
@@ -265,6 +291,21 @@ public abstract class RepositoryManagerTestBase
return repository; return repository;
} }
/**
* Method description
*
*
* @return
*/
private Repository createRepositoryWithId()
{
Repository repository = RepositoryTestData.createHeartOfGold();
repository.setId("abc");
return repository;
}
/** /**
* Method description * Method description
* *

View File

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