UserNamespaceAuthorizationHelper { public List<NamespacePermissionEnum> getNamespacePermissions(UserNamespaceAuthorizationEntity userNamespaceAuthorizationEntity) { List<NamespacePermissionEnum> namespacePermissions = new ArrayList<>(); if (BooleanUtils.isTrue(userNamespaceAuthorizationEntity.getReadPermission())) { namespacePermissions.add(NamespacePermissionEnum.READ); } if (BooleanUtils.isTrue(userNamespaceAuthorizationEntity.getWritePermission())) { namespacePermissions.add(NamespacePermissionEnum.WRITE); } if (BooleanUtils.isTrue(userNamespaceAuthorizationEntity.getExecutePermission())) { namespacePermissions.add(NamespacePermissionEnum.EXECUTE); } if (BooleanUtils.isTrue(userNamespaceAuthorizationEntity.getGrantPermission())) { namespacePermissions.add(NamespacePermissionEnum.GRANT); } if (BooleanUtils.isTrue(userNamespaceAuthorizationEntity.getWriteDescriptiveContentPermission())) { namespacePermissions.add(NamespacePermissionEnum.WRITE_DESCRIPTIVE_CONTENT); } if (BooleanUtils.isTrue(userNamespaceAuthorizationEntity.getWriteAttributePermission())) { namespacePermissions.add(NamespacePermissionEnum.WRITE_ATTRIBUTE); } return namespacePermissions; }  void buildNamespaceAuthorizations(ApplicationUser applicationUser); Set<NamespaceAuthorization> getAllNamespaceAuthorizations(); List<NamespacePermissionEnum> getNamespacePermissions(UserNamespaceAuthorizationEntity userNamespaceAuthorizationEntity);  }
@Test public void testGetNamespacePermissions() { UserNamespaceAuthorizationEntity userNamespaceAuthorizationEntity = new UserNamespaceAuthorizationEntity(); userNamespaceAuthorizationEntity.setExecutePermission(true); userNamespaceAuthorizationEntity.setGrantPermission(true); userNamespaceAuthorizationEntity.setReadPermission(true); userNamespaceAuthorizationEntity.setWritePermission(true); userNamespaceAuthorizationEntity.setWriteAttributePermission(true); userNamespaceAuthorizationEntity.setWriteDescriptiveContentPermission(true); List<NamespacePermissionEnum> namespacePermissions = userNamespaceAuthorizationHelper.getNamespacePermissions(userNamespaceAuthorizationEntity); assertThat(namespacePermissions.contains(NamespacePermissionEnum.EXECUTE), is(true)); assertThat(namespacePermissions.contains(NamespacePermissionEnum.GRANT), is(true)); assertThat(namespacePermissions.contains(NamespacePermissionEnum.READ), is(true)); assertThat(namespacePermissions.contains(NamespacePermissionEnum.WRITE), is(true)); assertThat(namespacePermissions.contains(NamespacePermissionEnum.WRITE_ATTRIBUTE), is(true)); assertThat(namespacePermissions.contains(NamespacePermissionEnum.WRITE_DESCRIPTIVE_CONTENT), is(true)); }