From caadc2a9695d6a8f04d841bbb116ded3ece3ef0d Mon Sep 17 00:00:00 2001 From: Fabrice Lecomte Date: Thu, 14 Jan 2021 22:53:48 +0100 Subject: [PATCH] klint --- src/main/kotlin/component/article/Article.kt | 6 +++--- src/main/kotlin/component/article/ArticleVoter.kt | 14 +++++++------- .../component/article/routes/FindArticles.kt | 2 +- .../component/article/routes/GetOneArticle.kt | 1 - src/main/kotlin/component/citizen/CitizenVoter.kt | 8 ++++---- .../kotlin/component/comment/generic/Comment.kt | 6 +++--- .../component/comment/generic/CommentRepository.kt | 2 +- .../generic/routes/GetCommentChildrenRequest.kt | 1 - .../comment/generic/routes/GetOneComment.kt | 1 - src/main/kotlin/dto/Opinionable.kt | 2 +- src/main/kotlin/dto/Versionable.kt | 1 - src/main/kotlin/dto/Votable.kt | 2 +- src/main/kotlin/elasticsearch/Config.kt | 2 +- src/main/kotlin/entity/Extra.kt | 2 +- src/main/kotlin/entity/Follow.kt | 4 ++-- src/main/kotlin/entity/Opinion.kt | 4 ++-- src/main/kotlin/entity/Versionable.kt | 4 ++-- src/main/kotlin/entity/Vote.kt | 5 ++--- src/main/kotlin/entity/Workgroup.kt | 2 +- src/main/kotlin/repository/Workgroup.kt | 4 ++-- src/main/kotlin/voter/ConstitutionVoter.kt | 4 ++-- src/main/kotlin/voter/OpinionChoiceVoter.kt | 4 ++-- src/main/kotlin/voter/OpinionVoter.kt | 4 ++-- src/main/kotlin/voter/VoteVoter.kt | 2 +- src/main/kotlin/voter/VoterModule.kt | 6 +++--- src/main/kotlin/voter/WorkgroupVoter.kt | 5 ++--- src/test/kotlin/security/voter/ArticleVoterTest.kt | 4 ++-- src/test/kotlin/security/voter/CommentVoterTest.kt | 2 +- src/test/kotlin/security/voter/VoteVoterTest.kt | 2 +- 29 files changed, 50 insertions(+), 56 deletions(-) diff --git a/src/main/kotlin/component/article/Article.kt b/src/main/kotlin/component/article/Article.kt index e57075d..92dc64e 100644 --- a/src/main/kotlin/component/article/Article.kt +++ b/src/main/kotlin/component/article/Article.kt @@ -6,7 +6,7 @@ import fr.postgresjson.entity.* import org.joda.time.DateTime import java.util.* -data class ArticleForView ( +data class ArticleForView( override val id: UUID = UUID.randomUUID(), override val title: String, val anonymous: Boolean = true, @@ -32,7 +32,7 @@ data class ArticleForView ( val lastVersion: Boolean = false } -interface ArticleForUpdateI : ArticleI, ArticleWithTitleI, VersionableRef, TargetI, CreatedBy { +interface ArticleForUpdateI : ArticleI, ArticleWithTitleI, VersionableRef, TargetI, CreatedBy { val anonymous: Boolean val content: String val description: String @@ -40,7 +40,7 @@ interface ArticleForUpdateI : ArticleI, ArticleWithTitleI, Versio val workgroup: WorkgroupRef? } -class ArticleForUpdate ( +class ArticleForUpdate( id: UUID? = null, override val title: String, override val anonymous: Boolean = true, diff --git a/src/main/kotlin/component/article/ArticleVoter.kt b/src/main/kotlin/component/article/ArticleVoter.kt index aca592f..cd7ae50 100644 --- a/src/main/kotlin/component/article/ArticleVoter.kt +++ b/src/main/kotlin/component/article/ArticleVoter.kt @@ -6,17 +6,17 @@ import fr.dcproject.entity.VersionableRef import fr.dcproject.voter.Voter import fr.dcproject.voter.VoterResponse -class ArticleVoter(private val articleRepo: ArticleRepository): Voter() { - fun > canView(subjects: List, citizen: CitizenI?): VoterResponse = +class ArticleVoter(private val articleRepo: ArticleRepository) : Voter() { + fun > canView(subjects: List, citizen: CitizenI?): VoterResponse = canAll(subjects) { canView(it, citizen) } - fun > canView(subject: S, citizen: CitizenI?): VoterResponse { + fun > canView(subject: S, citizen: CitizenI?): VoterResponse { return if (subject.isDeleted()) denied("Article is deleted", "article.deleted") else if (subject.draft && (citizen == null || subject.createdBy.id != citizen.id)) denied("Article is draft, but it's not yours", "article.draft.not.yours") else granted() } - fun > canDelete(subject: S, citizen: CitizenI?): VoterResponse { + fun > canDelete(subject: S, citizen: CitizenI?): VoterResponse { if (citizen == null) return denied("You must be connected to create article", "article.create.notConnected") return if (subject.createdBy.id == citizen.id) { granted() @@ -26,9 +26,9 @@ class ArticleVoter(private val articleRepo: ArticleRepository): Voter() { } fun canUpsert(subject: S, citizen: CitizenI?): VoterResponse - where S: ArticleI, - S: CreatedBy<*>, - S: VersionableRef { + where S : ArticleI, + S : CreatedBy<*>, + S : VersionableRef { if (citizen == null) return denied("You must be connected to create article", "article.create.notConnected") /* The new Article must by created by the same citizen of the connected citizen */ if (subject.createdBy.id == citizen.id) { diff --git a/src/main/kotlin/component/article/routes/FindArticles.kt b/src/main/kotlin/component/article/routes/FindArticles.kt index babf745..517d807 100644 --- a/src/main/kotlin/component/article/routes/FindArticles.kt +++ b/src/main/kotlin/component/article/routes/FindArticles.kt @@ -37,7 +37,7 @@ private fun ArticleRepository.findArticles(request: ArticlesRequest): Paginated< ) } -fun Route.findArticles (repo: ArticleRepository, voter: ArticleVoter) { +fun Route.findArticles(repo: ArticleRepository, voter: ArticleVoter) { get { repo.findArticles(it) .apply { voter.assert { canView(result, citizenOrNull) } } diff --git a/src/main/kotlin/component/article/routes/GetOneArticle.kt b/src/main/kotlin/component/article/routes/GetOneArticle.kt index de008d8..43c9b77 100644 --- a/src/main/kotlin/component/article/routes/GetOneArticle.kt +++ b/src/main/kotlin/component/article/routes/GetOneArticle.kt @@ -19,7 +19,6 @@ import org.koin.core.KoinComponent import org.koin.core.inject import java.util.* - @KtorExperimentalLocationsAPI @Location("/articles/{articleId}") class ArticleRequest(val articleId: UUID) : KoinComponent { diff --git a/src/main/kotlin/component/citizen/CitizenVoter.kt b/src/main/kotlin/component/citizen/CitizenVoter.kt index a18e7f9..82f0927 100644 --- a/src/main/kotlin/component/citizen/CitizenVoter.kt +++ b/src/main/kotlin/component/citizen/CitizenVoter.kt @@ -5,21 +5,21 @@ import fr.dcproject.voter.VoterResponse import fr.postgresjson.entity.EntityDeletedAt class CitizenVoter : Voter() { - fun canView(subjects: List, connectedCitizen: CitizenI?): VoterResponse where S : CitizenI, S: EntityDeletedAt = + fun canView(subjects: List, connectedCitizen: CitizenI?): VoterResponse where S : CitizenI, S : EntityDeletedAt = canAll(subjects) { canView(it, connectedCitizen) } - fun canView(subject: S, connectedCitizen: CitizenI?): VoterResponse where S : CitizenI, S: EntityDeletedAt { + fun canView(subject: S, connectedCitizen: CitizenI?): VoterResponse where S : CitizenI, S : EntityDeletedAt { if (connectedCitizen == null) return denied("You must be connected to view citizen", "citizen.view.connected") return if (subject.isDeleted()) denied("You cannot view a deleted citizen", "citizen.view.deleted") else granted() } - fun canUpdate(subject: S, connectedCitizen: CitizenI?): VoterResponse { + fun canUpdate(subject: S, connectedCitizen: CitizenI?): VoterResponse { if (connectedCitizen == null) return denied("You must be connected to update Citizen", "citizen.update.notConnected") return if (subject.id == connectedCitizen.id) granted() else denied("You can only update your citizen", "citizen.update.notYours") } - fun canChangePassword(subject: S, connectedCitizen: CitizenI?): VoterResponse { + fun canChangePassword(subject: S, connectedCitizen: CitizenI?): VoterResponse { if (connectedCitizen == null) return denied("You must be connected to change your password", "citizen.changePassword.notConnected") return if (subject.id == connectedCitizen.id) granted() else denied("You can only change your password", "citizen.password.notYours") } diff --git a/src/main/kotlin/component/comment/generic/Comment.kt b/src/main/kotlin/component/comment/generic/Comment.kt index 3d0c929..c37171f 100644 --- a/src/main/kotlin/component/comment/generic/Comment.kt +++ b/src/main/kotlin/component/comment/generic/Comment.kt @@ -35,7 +35,7 @@ class CommentForView( ) } -open class CommentForUpdate( +open class CommentForUpdate( override val id: UUID = UUID.randomUUID(), override val createdBy: C, override val target: T, @@ -61,14 +61,14 @@ open class CommentForUpdate( ) } -open class CommentParent( +open class CommentParent( override val id: UUID, override val deletedAt: DateTime?, override val target: T ) : CommentRef(id), CommentParentI -interface CommentParentI : CommentI, EntityDeletedAt, CommentWithTargetI +interface CommentParentI : CommentI, EntityDeletedAt, CommentWithTargetI interface CommentWithTargetI : CommentI, TargetI, AsTarget diff --git a/src/main/kotlin/component/comment/generic/CommentRepository.kt b/src/main/kotlin/component/comment/generic/CommentRepository.kt index 00104d9..170b730 100644 --- a/src/main/kotlin/component/comment/generic/CommentRepository.kt +++ b/src/main/kotlin/component/comment/generic/CommentRepository.kt @@ -67,7 +67,7 @@ abstract class CommentRepositoryAbs(override var requester: Request } } - fun comment(comment: CommentForUpdate) { + fun comment(comment: CommentForUpdate) { requester .getFunction("comment") .sendQuery( diff --git a/src/main/kotlin/component/comment/generic/routes/GetCommentChildrenRequest.kt b/src/main/kotlin/component/comment/generic/routes/GetCommentChildrenRequest.kt index 78e1ac7..3e98e28 100644 --- a/src/main/kotlin/component/comment/generic/routes/GetCommentChildrenRequest.kt +++ b/src/main/kotlin/component/comment/generic/routes/GetCommentChildrenRequest.kt @@ -23,7 +23,6 @@ class CommentChildrenRequest( val limit: Int = if (limit > 50) 50 else if (limit < 1) 1 else limit } - @KtorExperimentalAPI @KtorExperimentalLocationsAPI fun Route.getChildrenComments(repo: CommentRepository) { diff --git a/src/main/kotlin/component/comment/generic/routes/GetOneComment.kt b/src/main/kotlin/component/comment/generic/routes/GetOneComment.kt index 2cd1da6..2c4c54d 100644 --- a/src/main/kotlin/component/comment/generic/routes/GetOneComment.kt +++ b/src/main/kotlin/component/comment/generic/routes/GetOneComment.kt @@ -16,7 +16,6 @@ import io.ktor.util.* @Location("/comments/{comment}") class CommentRequest(val comment: CommentRef) - @KtorExperimentalAPI @KtorExperimentalLocationsAPI fun Route.getOneComment(repo: CommentRepository) { diff --git a/src/main/kotlin/dto/Opinionable.kt b/src/main/kotlin/dto/Opinionable.kt index e8bb583..4170315 100644 --- a/src/main/kotlin/dto/Opinionable.kt +++ b/src/main/kotlin/dto/Opinionable.kt @@ -5,7 +5,7 @@ typealias Opinions = Map interface Opinionable { val opinions: Opinions - class Imp(parent: fr.dcproject.entity.Opinionable): Opinionable { + class Imp(parent: fr.dcproject.entity.Opinionable) : Opinionable { override val opinions: Opinions = parent.opinions } } \ No newline at end of file diff --git a/src/main/kotlin/dto/Versionable.kt b/src/main/kotlin/dto/Versionable.kt index d38070a..82a54ac 100644 --- a/src/main/kotlin/dto/Versionable.kt +++ b/src/main/kotlin/dto/Versionable.kt @@ -12,4 +12,3 @@ interface Versionable { override val versionId: UUID = parent.versionId } } - diff --git a/src/main/kotlin/dto/Votable.kt b/src/main/kotlin/dto/Votable.kt index 156c786..7252bc4 100644 --- a/src/main/kotlin/dto/Votable.kt +++ b/src/main/kotlin/dto/Votable.kt @@ -3,7 +3,7 @@ package fr.dcproject.dto interface Votable { val votes: VoteAggregation - class Imp(parent: fr.dcproject.entity.Votable): Votable { + class Imp(parent: fr.dcproject.entity.Votable) : Votable { override val votes: VoteAggregation = VoteAggregation(parent) } } \ No newline at end of file diff --git a/src/main/kotlin/elasticsearch/Config.kt b/src/main/kotlin/elasticsearch/Config.kt index 8ef8567..83d7a4f 100644 --- a/src/main/kotlin/elasticsearch/Config.kt +++ b/src/main/kotlin/elasticsearch/Config.kt @@ -8,7 +8,7 @@ import org.slf4j.LoggerFactory fun waitElasticsearchIsUp(client: RestClient) { val logger: Logger = LoggerFactory.getLogger("fr.dcproject.elasticsearch") val request = Request("GET", "/_cluster/health") - repeat(5*60/2) { // 5 minutes + repeat(5*60 / 2) { // 5 minutes runCatching { client.performRequest(request).statusLine.statusCode }.onSuccess { diff --git a/src/main/kotlin/entity/Extra.kt b/src/main/kotlin/entity/Extra.kt index e7dfa65..dd3f6ea 100644 --- a/src/main/kotlin/entity/Extra.kt +++ b/src/main/kotlin/entity/Extra.kt @@ -17,7 +17,7 @@ interface ExtraI : EntityCreatedAt, EntityCreatedBy -interface AsTarget { +interface AsTarget { val target: T } diff --git a/src/main/kotlin/entity/Follow.kt b/src/main/kotlin/entity/Follow.kt index 523c8e2..9789ecb 100644 --- a/src/main/kotlin/entity/Follow.kt +++ b/src/main/kotlin/entity/Follow.kt @@ -24,7 +24,7 @@ open class FollowSimple( EntityCreatedAt by EntityCreatedAtImp(), EntityCreatedBy by EntityCreatedByImp(createdBy) -class FollowForUpdate( +class FollowForUpdate( id: UUID = UUID.randomUUID(), override val target: T, override val createdBy: C @@ -36,4 +36,4 @@ open class FollowRef( override val id: UUID ) : FollowI -interface FollowI: UuidEntityI \ No newline at end of file +interface FollowI : UuidEntityI \ No newline at end of file diff --git a/src/main/kotlin/entity/Opinion.kt b/src/main/kotlin/entity/Opinion.kt index a03221d..3386ea0 100644 --- a/src/main/kotlin/entity/Opinion.kt +++ b/src/main/kotlin/entity/Opinion.kt @@ -30,7 +30,7 @@ class OpinionArticle( choice: OpinionChoice ) : Opinion(id, createdBy, target, choice) -data class OpinionForUpdate( +data class OpinionForUpdate( override val id: UUID = UUID.randomUUID(), val target: T, val choice: OpinionChoice, @@ -42,4 +42,4 @@ open class OpinionRef( override val id: UUID ) : OpinionI -interface OpinionI: UuidEntityI \ No newline at end of file +interface OpinionI : UuidEntityI \ No newline at end of file diff --git a/src/main/kotlin/entity/Versionable.kt b/src/main/kotlin/entity/Versionable.kt index 70c5f25..8d671fa 100644 --- a/src/main/kotlin/entity/Versionable.kt +++ b/src/main/kotlin/entity/Versionable.kt @@ -7,11 +7,11 @@ interface VersionableRef { val versionId: UUID } -class VersionableRefImp ( +class VersionableRefImp( override val versionId: UUID ) : VersionableRef -interface Versionable: VersionableRef, EntityVersioning { +interface Versionable : VersionableRef, EntityVersioning { override val versionId: UUID override val versionNumber: Int } \ No newline at end of file diff --git a/src/main/kotlin/entity/Vote.kt b/src/main/kotlin/entity/Vote.kt index d3c5a77..5c9e810 100644 --- a/src/main/kotlin/entity/Vote.kt +++ b/src/main/kotlin/entity/Vote.kt @@ -24,7 +24,7 @@ class Vote( } } -class VoteForUpdate( +class VoteForUpdate( override val id: UUID = UUID.randomUUID(), override val note: Int, override val target: T, @@ -33,14 +33,13 @@ class VoteForUpdate( VoteForUpdateI, EntityCreatedBy by EntityCreatedByImp(createdBy) -interface VoteForUpdateI : VoteI, AsTarget, EntityCreatedBy { +interface VoteForUpdateI : VoteI, AsTarget, EntityCreatedBy { override val id: UUID val note: Int override val target: T override val createdBy: C } - open class VoteRef( override val id: UUID ) : VoteI diff --git a/src/main/kotlin/entity/Workgroup.kt b/src/main/kotlin/entity/Workgroup.kt index 80de703..412b6f1 100644 --- a/src/main/kotlin/entity/Workgroup.kt +++ b/src/main/kotlin/entity/Workgroup.kt @@ -10,7 +10,7 @@ import fr.postgresjson.entity.EntityI import java.util.* @Deprecated("") -data class Workgroup ( +data class Workgroup ( override val id: UUID = UUID.randomUUID(), override var name: String, override var description: String, diff --git a/src/main/kotlin/repository/Workgroup.kt b/src/main/kotlin/repository/Workgroup.kt index 59d4883..466060c 100644 --- a/src/main/kotlin/repository/Workgroup.kt +++ b/src/main/kotlin/repository/Workgroup.kt @@ -42,11 +42,11 @@ class Workgroup(override var requester: Requester) : RepositoryI { ) } - fun > upsert(workgroup: W): WorkgroupEntity = requester + fun > upsert(workgroup: W): WorkgroupEntity = requester .getFunction("upsert_workgroup") .selectOne("resource" to workgroup) ?: error("query 'upsert_workgroup' return null") - fun delete(workgroup: W) = requester + fun delete(workgroup: W) = requester .getFunction("delete_workgroup") .perform("id" to workgroup.id) diff --git a/src/main/kotlin/voter/ConstitutionVoter.kt b/src/main/kotlin/voter/ConstitutionVoter.kt index 84399dc..70d6c04 100644 --- a/src/main/kotlin/voter/ConstitutionVoter.kt +++ b/src/main/kotlin/voter/ConstitutionVoter.kt @@ -20,8 +20,8 @@ class ConstitutionVoter : Voter { } override fun invoke(action: Any, context: ApplicationCall, subject: Any?): VoterResponseI { - if(!((action is Action || action is CommentVoter.Action || action is VoteVoter.Action) - && (subject is ConstitutionSimple<*, *>? || subject is VoteEntity<*> || subject is CommentForView<*, *>))) return abstain() + if (!((action is Action || action is CommentVoter.Action || action is VoteVoter.Action) && + (subject is ConstitutionSimple<*, *>? || subject is VoteEntity<*> || subject is CommentForView<*, *>))) return abstain() val user = context.user if (action == Action.CREATE && user != null) { diff --git a/src/main/kotlin/voter/OpinionChoiceVoter.kt b/src/main/kotlin/voter/OpinionChoiceVoter.kt index 4d5b1a0..ac292ad 100644 --- a/src/main/kotlin/voter/OpinionChoiceVoter.kt +++ b/src/main/kotlin/voter/OpinionChoiceVoter.kt @@ -11,8 +11,8 @@ class OpinionChoiceVoter : Voter { } override fun invoke(action: Any, context: ApplicationCall, subject: Any?): VoterResponseI { - if (!((action is Action) - && (subject is OpinionChoice?))) return abstain() + if (!((action is Action) && + (subject is OpinionChoice?))) return abstain() if (action == Action.VIEW) { if (subject is OpinionChoice) { diff --git a/src/main/kotlin/voter/OpinionVoter.kt b/src/main/kotlin/voter/OpinionVoter.kt index 801ebe7..97e82e0 100644 --- a/src/main/kotlin/voter/OpinionVoter.kt +++ b/src/main/kotlin/voter/OpinionVoter.kt @@ -17,8 +17,8 @@ class OpinionVoter : Voter { } override fun invoke(action: Any, context: ApplicationCall, subject: Any?): VoterResponseI { - if (!((action is Action) - && (subject is Opinion<*>? || subject is ArticleAuthI<*>))) return abstain() + if (!((action is Action) && + (subject is Opinion<*>? || subject is ArticleAuthI<*>))) return abstain() val user = context.user if (action == Action.CREATE) { diff --git a/src/main/kotlin/voter/VoteVoter.kt b/src/main/kotlin/voter/VoteVoter.kt index 6f7a0f7..36b01ef 100644 --- a/src/main/kotlin/voter/VoteVoter.kt +++ b/src/main/kotlin/voter/VoteVoter.kt @@ -26,7 +26,7 @@ class VoteVoter : Voter { subject.target.let { if (it is EntityDeletedAt) { if (it.isDeleted()) return denied("You cannot vote on deleted target", "vote.create.isDeleted") - } else { + } else { throw NoSubjectDefinedException(action) } } diff --git a/src/main/kotlin/voter/VoterModule.kt b/src/main/kotlin/voter/VoterModule.kt index 0f7813f..27f94ef 100644 --- a/src/main/kotlin/voter/VoterModule.kt +++ b/src/main/kotlin/voter/VoterModule.kt @@ -25,12 +25,12 @@ abstract class Voter { private fun VoterResponses.getOneResponse(): VoterResponse = this.firstOrNull { it.vote == Vote.DENIED } ?: granted() - protected fun , T> canAll(items: S, action: (T) -> VoterResponse): VoterResponse = items + protected fun , T> canAll(items: S, action: (T) -> VoterResponse): VoterResponse = items .map { action(it) } .getOneResponse() } -fun T.assert(action: T.() -> VoterResponse) { +fun T.assert(action: T.() -> VoterResponse) { action().assert() } @@ -58,7 +58,7 @@ class VoterDeniedException(private val voterResponses: VoterResponses) : Throwab .message } -sealed class VoterResponse ( +sealed class VoterResponse( val vote: Vote, val voter: Voter, val message: String?, diff --git a/src/main/kotlin/voter/WorkgroupVoter.kt b/src/main/kotlin/voter/WorkgroupVoter.kt index e0fa93f..d71b8f1 100644 --- a/src/main/kotlin/voter/WorkgroupVoter.kt +++ b/src/main/kotlin/voter/WorkgroupVoter.kt @@ -27,8 +27,8 @@ class WorkgroupVoter : Voter { override fun invoke(action: Any, context: ApplicationCall, subject: Any?): VoterResponseI { if ((action is Action && subject == null)) throw NoSubjectDefinedException(action) - if (!((action is Action || action is ActionMembers) - && (subject is WorkgroupI? || (subject is List<*> && subject.first() is WorkgroupI)))) return abstain() + if (!((action is Action || action is ActionMembers) && + (subject is WorkgroupI? || (subject is List<*> && subject.first() is WorkgroupI)))) return abstain() val user = context.user if (action == Action.CREATE) { @@ -38,7 +38,6 @@ class WorkgroupVoter : Voter { } } - if (action == Action.VIEW) { if (subject is WorkgroupWithAuthI<*>) { return if (subject.isDeleted()) denied("You cannot view a deleted workgroup", "workgroup.view.deleted") diff --git a/src/test/kotlin/security/voter/ArticleVoterTest.kt b/src/test/kotlin/security/voter/ArticleVoterTest.kt index 676ab18..b876f06 100644 --- a/src/test/kotlin/security/voter/ArticleVoterTest.kt +++ b/src/test/kotlin/security/voter/ArticleVoterTest.kt @@ -134,7 +134,7 @@ class ArticleVoterTest { } @Test - fun `can update article if yours`(): Unit { + fun `can update article if yours`() { val article = getArticle(tesla) ArticleVoter(getRepo(article)) .canUpsert(article, tesla) @@ -142,7 +142,7 @@ class ArticleVoterTest { } @Test - fun `can not update article if not yours`(): Unit { + fun `can not update article if not yours`() { val article = getArticle(tesla) ArticleVoter(getRepo(article)) .canUpsert(article, einstein) diff --git a/src/test/kotlin/security/voter/CommentVoterTest.kt b/src/test/kotlin/security/voter/CommentVoterTest.kt index de1cbde..17d53d0 100644 --- a/src/test/kotlin/security/voter/CommentVoterTest.kt +++ b/src/test/kotlin/security/voter/CommentVoterTest.kt @@ -125,7 +125,7 @@ internal class CommentVoterTest { } @Test - fun `can be view the comment`(): Unit { + fun `can be view the comment`() { listOf(CommentVoter()).run { mockk { every { citizenOrNull } returns tesla diff --git a/src/test/kotlin/security/voter/VoteVoterTest.kt b/src/test/kotlin/security/voter/VoteVoterTest.kt index 499f987..e91f632 100644 --- a/src/test/kotlin/security/voter/VoteVoterTest.kt +++ b/src/test/kotlin/security/voter/VoteVoterTest.kt @@ -168,7 +168,7 @@ internal class VoteVoterTest { } @Test - fun `can be vote an article`(): Unit { + fun `can be vote an article`() { listOf(VoteVoter()).run { mockk { every { citizenOrNull } returns tesla