@Test void displayButton() { when(this.likeConfiguration.alwaysDisplayButton()).thenReturn(true); assertTrue(this.likeScriptService.displayButton(null)); EntityReference entityReference = new DocumentReference("xwiki", "Foo", "Foo"); assertTrue(this.likeScriptService.displayButton(entityReference)); when(this.likeConfiguration.alwaysDisplayButton()).thenReturn(false); assertFalse(this.likeScriptService.displayButton(null)); when(this.authorizationManager.hasAccess(this.likeRight, this.docUserReference, entityReference)) .thenReturn(true); assertTrue(this.likeScriptService.displayButton(entityReference)); verify(this.authorizationManager).hasAccess(this.likeRight, this.docUserReference, entityReference); }
public boolean displayButton(EntityReference entityReference) { return this.likeConfiguration.alwaysDisplayButton() || this.isAuthorized(entityReference); }
LikeScriptService implements ScriptService { public boolean displayButton(EntityReference entityReference) { return this.likeConfiguration.alwaysDisplayButton() || this.isAuthorized(entityReference); } }
LikeScriptService implements ScriptService { public boolean displayButton(EntityReference entityReference) { return this.likeConfiguration.alwaysDisplayButton() || this.isAuthorized(entityReference); }  }
LikeScriptService implements ScriptService { public boolean displayButton(EntityReference entityReference) { return this.likeConfiguration.alwaysDisplayButton() || this.isAuthorized(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(); }
LikeScriptService implements ScriptService { public boolean displayButton(EntityReference entityReference) { return this.likeConfiguration.alwaysDisplayButton() || this.isAuthorized(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();  }