### Question:
IssueUtils { public boolean canComment(Issue issue) { return issue != null && !issue.locked || (issue != null && issue.repository != null && (issue.repository.permissions.push || issue.repository.permissions.admin)); }  boolean canComment(Issue issue);  }### Answer:
@Test public void shouldReturnFalse_whenIssueIsLocked() { issue.locked = true; assertThat(iu.canComment(issue)).isFalse(); }
@Test public void shouldReturnTrue_whenIssueIsUnlocked() { issue.locked = false; assertThat(iu.canComment(issue)).isTrue(); }
@Test public void shouldReturnTrue_whenPushAccessAndLocked() { permissions.push = true; issue.locked = true; assertThat(iu.canComment(issue)).isTrue(); }
@Test public void shouldReturnTrue_whenAdminAccessAndLocked() { permissions.admin = true; issue.locked = true; assertThat(iu.canComment(issue)).isTrue(); }
@Test public void shouldReturnFalse_whenPullAccessAndLocked() { permissions.pull = true; issue.locked = true; assertThat(iu.canComment(issue)).isFalse(); }
@Test public void shouldReturnFalse_whenNullIssue() { assertThat(iu.canComment(null)).isFalse(); }
@Test public void shouldReturnFalse_whenNullRepositoryAndLocked() { issue.locked = true; issue.repository = null; assertThat(iu.canComment(issue)).isFalse(); }
@Test public void shouldReturnTrue_whenLockedWithPushAccess() { issue.locked = true; permissions.push = true; assertThat(iu.canComment(issue)).isTrue(); }
@Test public void shouldReturnTrue_whenLockedWithAdminAccess() { issue.locked = true; permissions.admin = true; assertThat(iu.canComment(issue)).isTrue(); }
@Test public void shouldReturnTrue_whenNullRepositoryAndUnlocked() { issue.locked = false; issue.repository = null; assertThat(iu.canComment(issue)).isTrue(); }