CCM NG: Fixed failures in ContentTypeRepositoryTest

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@6004 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2019-05-03 17:52:21 +00:00
parent 712b015dd8
commit 2573ac4da1
1 changed files with 11 additions and 9 deletions

View File

@ -334,6 +334,7 @@ public class ContentTypeRepositoryTest {
.addClass(org.libreccm.core.Resource.class) .addClass(org.libreccm.core.Resource.class)
.addClass(org.libreccm.core.ResourceType.class) .addClass(org.libreccm.core.ResourceType.class)
.addClass(org.libreccm.core.UnexpectedErrorException.class) .addClass(org.libreccm.core.UnexpectedErrorException.class)
.addClass(org.libreccm.imexport.Exportable.class)
.addClass(org.libreccm.jpa.EntityManagerProducer.class) .addClass(org.libreccm.jpa.EntityManagerProducer.class)
.addClass(org.libreccm.l10n.GlobalizationHelper.class) .addClass(org.libreccm.l10n.GlobalizationHelper.class)
.addClass(org.libreccm.l10n.GlobalizedMessagesUtil.class) .addClass(org.libreccm.l10n.GlobalizedMessagesUtil.class)
@ -372,6 +373,7 @@ public class ContentTypeRepositoryTest {
.addClass(org.libreccm.security.Permission.class) .addClass(org.libreccm.security.Permission.class)
.addClass(org.libreccm.security.PermissionChecker.class) .addClass(org.libreccm.security.PermissionChecker.class)
.addClass(org.libreccm.security.PermissionManager.class) .addClass(org.libreccm.security.PermissionManager.class)
.addClass(org.libreccm.security.PermissionRepository.class)
.addClass(org.libreccm.security.RecursivePermissions.class) .addClass(org.libreccm.security.RecursivePermissions.class)
.addClass(org.libreccm.security.RegistrationManager.class) .addClass(org.libreccm.security.RegistrationManager.class)
.addClass(org.libreccm.security.Relation.class) .addClass(org.libreccm.security.Relation.class)
@ -454,7 +456,7 @@ public class ContentTypeRepositoryTest {
@UsingDataSet("datasets/org/librecms/contentsection/" @UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentTypeRepositoryTest/data.xml") + "ContentTypeRepositoryTest/data.xml")
public void findByContentSection() { public void findByContentSection() {
final ContentSection section = contentSectionRepo.findById(-1001L).get(); final ContentSection section = contentSectionRepo.findById(1001L).get();
final List<ContentType> types = contentTypeRepo.findByContentSection( final List<ContentType> types = contentTypeRepo.findByContentSection(
section); section);
@ -497,7 +499,7 @@ public class ContentTypeRepositoryTest {
@UsingDataSet("datasets/org/librecms/contentsection/" @UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentTypeRepositoryTest/data.xml") + "ContentTypeRepositoryTest/data.xml")
public void findByContentSectionAndClass() { public void findByContentSectionAndClass() {
final ContentSection section = contentSectionRepo.findById(-1001L).get(); final ContentSection section = contentSectionRepo.findById(1001L).get();
final Optional<ContentType> articleType = contentTypeRepo final Optional<ContentType> articleType = contentTypeRepo
.findByContentSectionAndClass(section, Article.class); .findByContentSectionAndClass(section, Article.class);
final Optional<ContentType> newsType = contentTypeRepo final Optional<ContentType> newsType = contentTypeRepo
@ -548,7 +550,7 @@ public class ContentTypeRepositoryTest {
+ "ContentTypeRepositoryTest/data.xml") + "ContentTypeRepositoryTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
public void findByContentSectionAndClassNull() { public void findByContentSectionAndClassNull() {
final ContentSection section = contentSectionRepo.findById(-1001L).get(); final ContentSection section = contentSectionRepo.findById(1001L).get();
final Class<? extends ContentItem> type = null; final Class<? extends ContentItem> type = null;
contentTypeRepo.findByContentSectionAndClass(section, type); contentTypeRepo.findByContentSectionAndClass(section, type);
} }
@ -563,7 +565,7 @@ public class ContentTypeRepositoryTest {
@UsingDataSet("datasets/org/librecms/contentsection/" @UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentTypeRepositoryTest/data.xml") + "ContentTypeRepositoryTest/data.xml")
public void findByContentSectionAndClassName() { public void findByContentSectionAndClassName() {
final ContentSection section = contentSectionRepo.findById(-1001L).get(); final ContentSection section = contentSectionRepo.findById(1001L).get();
final Optional<ContentType> articleType = contentTypeRepo final Optional<ContentType> articleType = contentTypeRepo
.findByContentSectionAndClass(section, Article.class.getName()); .findByContentSectionAndClass(section, Article.class.getName());
final Optional<ContentType> newsType = contentTypeRepo final Optional<ContentType> newsType = contentTypeRepo
@ -616,7 +618,7 @@ public class ContentTypeRepositoryTest {
+ "ContentTypeRepositoryTest/data.xml") + "ContentTypeRepositoryTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
public void findByContentSectionAndClassNameNull() { public void findByContentSectionAndClassNameNull() {
final ContentSection section = contentSectionRepo.findById(-1001L).get(); final ContentSection section = contentSectionRepo.findById(1001L).get();
final String type = null; final String type = null;
contentTypeRepo.findByContentSectionAndClass(section, type); contentTypeRepo.findByContentSectionAndClass(section, type);
} }
@ -630,7 +632,7 @@ public class ContentTypeRepositoryTest {
@UsingDataSet("datasets/org/librecms/contentsection/" @UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentTypeRepositoryTest/data.xml") + "ContentTypeRepositoryTest/data.xml")
public void verifyIsContentTypeInUse() { public void verifyIsContentTypeInUse() {
final ContentSection section = contentSectionRepo.findById(-1001L).get(); final ContentSection section = contentSectionRepo.findById(1001L).get();
final Optional<ContentType> articleType = contentTypeRepo final Optional<ContentType> articleType = contentTypeRepo
.findByContentSectionAndClass(section, Article.class); .findByContentSectionAndClass(section, Article.class);
final Optional<ContentType> newsType = contentTypeRepo final Optional<ContentType> newsType = contentTypeRepo
@ -655,7 +657,7 @@ public class ContentTypeRepositoryTest {
@ShouldMatchDataSet("datasets/org/librecms/contentsection/" @ShouldMatchDataSet("datasets/org/librecms/contentsection/"
+ "ContentTypeRepositoryTest/after-delete.xml") + "ContentTypeRepositoryTest/after-delete.xml")
public void deleteUnusedContentType() { public void deleteUnusedContentType() {
final ContentSection section = contentSectionRepo.findById(-1001L).get(); final ContentSection section = contentSectionRepo.findById(1001L).get();
final Optional<ContentType> newsType = contentTypeRepo final Optional<ContentType> newsType = contentTypeRepo
.findByContentSectionAndClass(section, News.class); .findByContentSectionAndClass(section, News.class);
assertThat(newsType.isPresent(), is(true)); assertThat(newsType.isPresent(), is(true));
@ -676,7 +678,7 @@ public class ContentTypeRepositoryTest {
@ShouldThrowException(UnauthorizedException.class) @ShouldThrowException(UnauthorizedException.class)
public void deleteUnusedContentTypeUnauthorized() { public void deleteUnusedContentTypeUnauthorized() {
final ContentSection section = contentSectionRepo.findById(-1001L).get(); final ContentSection section = contentSectionRepo.findById(1001L).get();
final Optional<ContentType> newsType = contentTypeRepo final Optional<ContentType> newsType = contentTypeRepo
.findByContentSectionAndClass(section, News.class); .findByContentSectionAndClass(section, News.class);
assertThat(newsType.isPresent(), is(true)); assertThat(newsType.isPresent(), is(true));
@ -696,7 +698,7 @@ public class ContentTypeRepositoryTest {
+ "ContentTypeRepositoryTest/data.xml") + "ContentTypeRepositoryTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
public void deleteContentTypeInUse() { public void deleteContentTypeInUse() {
final ContentSection section = contentSectionRepo.findById(-1001L).get(); final ContentSection section = contentSectionRepo.findById(1001L).get();
final Optional<ContentType> articleType = contentTypeRepo final Optional<ContentType> articleType = contentTypeRepo
.findByContentSectionAndClass(section, Article.class); .findByContentSectionAndClass(section, Article.class);
assertThat(articleType.isPresent(), is(true)); assertThat(articleType.isPresent(), is(true));