### Question:
LikeScriptService implements ScriptService { public boolean isAuthorized(EntityReference entityReference) { DocumentReference userReference = this.contextProvider.get().getUserReference(); return userReference != null && this.authorizationManager.hasAccess(getLikeRight(), userReference, entityReference); }  boolean isAuthorized(EntityReference entityReference); boolean displayButton(EntityReference entityReference); Optional<Long> like(EntityReference entityReference); Optional<Long> unlike(EntityReference entityReference); Optional<Long> getLikes(EntityReference entityReference); List<EntityReference> getUserLikes(UserReference userReference, int offset, int limit); boolean isLiked(EntityReference entityReference); @Unstable List<UserReference> getLikers(EntityReference target, int offset, int limit); void cleanCacheUIX();  }### Answer:
@Test void isAuthorized() { EntityReference entityReference = new DocumentReference("xwiki", "Foo", "Foo"); when(this.authorizationManager.hasAccess(this.likeRight, this.docUserReference, entityReference)) .thenReturn(true); assertTrue(this.likeScriptService.isAuthorized(entityReference)); verify(this.authorizationManager).hasAccess(this.likeRight, this.docUserReference, entityReference); when(this.authorizationManager.hasAccess(this.likeRight, this.docUserReference, entityReference)) .thenReturn(false); assertFalse(this.likeScriptService.isAuthorized(entityReference)); verify(this.authorizationManager, times(2)).hasAccess(this.likeRight, this.docUserReference, entityReference); }