public boolean shouldDisplay(User user, JiraHelper jiraHelper) {
    final Map<String, Object> params = jiraHelper.getContextParams();

    final Issue issue = (Issue) params.get("issue");

    if (issue == null) {
      if (jiraHelper.getProject() != null) {
        return fieldVisibilityManager.isFieldHidden(
            jiraHelper.getProject().getLong("id"), field, issuetype);
      }
    } else {
      return fieldVisibilityManager.isFieldHidden(field, issue);
    }
    return false;
  }
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    final FieldVisibilityManager visibilityBean = EasyMock.createMock(FieldVisibilityManager.class);
    EasyMock.expect(
            visibilityBean.isFieldHidden(
                (String) EasyMock.anyObject(), (Issue) EasyMock.anyObject()))
        .andReturn(false)
        .anyTimes();
    EasyMock.replay(visibilityBean);
    ManagerFactory.addService(FieldVisibilityManager.class, visibilityBean);

    originalFactory =
        ComponentManager.getComponentInstanceOfType(FieldClausePermissionChecker.Factory.class);
    ManagerFactory.addService(
        FieldClausePermissionChecker.Factory.class, new MockFieldClausePermissionFactory());
    bob = createMockUser("bob");

    final Group group = addUserToNewGroup(bob, "group");
    carl = createMockUser("carl");

    final GenericValue project =
        UtilsForTests.getTestEntity("Project", EasyMap.build("key", "TST"));

    final PermissionSchemeManager permissionSchemeManager =
        ManagerFactory.getPermissionSchemeManager();
    final GenericValue defaultScheme = permissionSchemeManager.createDefaultScheme();
    final SchemeEntity schemeEntity =
        new SchemeEntity(GroupDropdown.DESC, null, Permissions.BROWSE);
    permissionSchemeManager.createSchemeEntity(defaultScheme, schemeEntity);

    permissionSchemeManager.addSchemeToProject(project, defaultScheme);

    UtilsForTests.getTestEntity("Resolution", EasyMap.build("id", resolutionId));
    // Create two Issues with same comment but different level
    final GenericValue issue1 =
        UtilsForTests.getTestEntity(
            "Issue",
            EasyMap.build(
                "project",
                project.getLong("id"),
                "key",
                "TST-1",
                "resolution",
                resolutionId,
                "summary",
                SUMMARY_BODY));
    UtilsForTests.getTestEntity(
        "Action",
        EasyMap.build(
            "issue",
            issue1.getLong("id"),
            "type",
            ActionConstants.TYPE_COMMENT,
            "body",
            COMMENT_BODY));

    final GenericValue issue2 =
        UtilsForTests.getTestEntity(
            "Issue",
            EasyMap.build(
                "project",
                project.getLong("id"),
                "key",
                "TST-2",
                "resolution",
                resolutionId,
                "summary",
                SUMMARY_BODY));
    UtilsForTests.getTestEntity(
        "Action",
        EasyMap.build(
            "issue",
            issue2.getLong("id"),
            "type",
            ActionConstants.TYPE_COMMENT,
            "body",
            COMMENT_BODY,
            "level",
            group.getName()));

    final GenericValue issue3 =
        UtilsForTests.getTestEntity(
            "Issue",
            EasyMap.build(
                "project",
                project.getLong("id"),
                "key",
                "TST-3",
                "resolution",
                resolutionId,
                "summary",
                ANOTHER_SUMMARY_BODY));
    UtilsForTests.getTestEntity(
        "Action",
        EasyMap.build(
            "issue",
            issue3.getLong("id"),
            "type",
            ActionConstants.TYPE_COMMENT,
            "body",
            ANOTHER_COMMENT_BODY,
            "level",
            group.getName()));

    ManagerFactory.getIndexManager().reIndexAll();
  }
 @Override
 public boolean isFieldVisibleAndInScope(final Issue issue) {
   return applicationProperties.getOption(APKeys.JIRA_OPTION_TIMETRACKING)
       && !fieldVisibilityManager.isFieldHidden(IssueFieldConstants.TIMETRACKING, issue);
 }