### Question:
LikeScriptService implements ScriptService { public boolean isLiked(EntityReference entityReference) { UserReference userReference = this.userReferenceResolver.resolve(this.contextProvider.get().getUserReference()); try { return this.likeManager.isLiked(userReference, entityReference); } catch (LikeException e) { this.logger.warn("Error while checking if [{}] is liked by [{}]", entityReference, userReference, ExceptionUtils.getRootCause(e)); } return false; }  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 isLiked() throws LikeException { EntityReference entityReference = new DocumentReference("xwiki", "Foo", "Foo"); when(this.likeManager.isLiked(userReference, entityReference)).thenReturn(false); assertFalse(this.likeScriptService.isLiked(entityReference)); when(this.likeManager.isLiked(userReference, entityReference)).thenReturn(true); assertTrue(this.likeScriptService.isLiked(entityReference)); }
@Test void isLikedError() throws LikeException { EntityReference entityReference = new DocumentReference("xwiki", "Foo", "Foo"); when(this.likeManager.isLiked(userReference, entityReference)).thenThrow(new LikeException("Problem")); assertFalse(this.likeScriptService.isLiked(entityReference)); assertEquals("Error while checking if [xwiki:Foo.Foo] is liked by [userReference]", logCapture.getMessage(0)); }