--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.sonar.core.issue;
+
+import com.google.common.collect.Maps;
+import org.sonar.api.component.Component;
+import org.sonar.api.issue.ActionPlan;
+import org.sonar.api.issue.Issue;
+import org.sonar.api.issue.IssueQueryResult;
+import org.sonar.api.rule.RuleKey;
+import org.sonar.api.rules.Rule;
+import org.sonar.api.user.User;
+import org.sonar.api.utils.Paging;
+
+import javax.annotation.CheckForNull;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+public class DefaultIssueQueryResult implements IssueQueryResult {
+
+ private List<Issue> issues;
+ private final Map<RuleKey, Rule> rulesByKey = Maps.newHashMap();
+ private final Map<String, Component> componentsByKey = Maps.newHashMap();
+ private final Map<String, Component> projectsByKey = Maps.newHashMap();
+ private final Map<String, ActionPlan> actionPlansByKey = Maps.newHashMap();
+ private final Map<String, User> usersByLogin = Maps.newHashMap();
+ private boolean securityExclusions;
+ private boolean maxResultsReached;
+ private Paging paging;
+
+ public DefaultIssueQueryResult setIssues(List<Issue> issues){
+ this.issues = issues;
+ return this;
+ }
+
+ public DefaultIssueQueryResult addRules(Collection<Rule> rules){
+ for (Rule rule : rules) {
+ rulesByKey.put(rule.ruleKey(), rule);
+ }
+ return this;
+ }
+
+ public DefaultIssueQueryResult addComponents(Collection<Component> components){
+ for (Component component : components) {
+ componentsByKey.put(component.key(), component);
+ }
+ return this;
+ }
+
+ public DefaultIssueQueryResult addProjects(Collection<Component> projects){
+ for (Component project : projects) {
+ projectsByKey.put(project.key(), project);
+ }
+ return this;
+ }
+
+ public DefaultIssueQueryResult addActionPlans(Collection<ActionPlan> actionPlans){
+ for (ActionPlan actionPlan : actionPlans) {
+ actionPlansByKey.put(actionPlan.key(), actionPlan);
+ }
+ return this;
+ }
+
+ public DefaultIssueQueryResult addUsers(Collection<User> users){
+ for (User user : users) {
+ usersByLogin.put(user.login(), user);
+ }
+ return this;
+ }
+
+ public DefaultIssueQueryResult setSecurityExclusions(boolean securityExclusions){
+ this.securityExclusions = securityExclusions;
+ return this;
+ }
+
+ public DefaultIssueQueryResult setMaxResultsReached(boolean maxResultsReached){
+ this.maxResultsReached = maxResultsReached;
+ return this;
+ }
+
+ public DefaultIssueQueryResult setPaging(Paging paging){
+ this.paging = paging;
+ return this;
+ }
+
+ @Override
+ public List<Issue> issues() {
+ return issues;
+ }
+
+ @Override
+ public Rule rule(Issue issue) {
+ return rulesByKey.get(issue.ruleKey());
+ }
+
+ @Override
+ public Collection<Rule> rules() {
+ return rulesByKey.values();
+ }
+
+ @Override
+ public Component component(Issue issue) {
+ return componentsByKey.get(issue.componentKey());
+ }
+
+ @Override
+ public Collection<Component> components() {
+ return componentsByKey.values();
+ }
+
+ @Override
+ public Component project(Issue issue) {
+ return projectsByKey.get(issue.projectKey());
+ }
+
+ @Override
+ public Collection<Component> projects() {
+ return projectsByKey.values();
+ }
+
+ @Override
+ public ActionPlan actionPlan(Issue issue) {
+ return actionPlansByKey.get(issue.actionPlanKey());
+ }
+
+ @Override
+ public Collection<ActionPlan> actionPlans() {
+ return actionPlansByKey.values();
+ }
+
+ @Override
+ public Collection<User> users() {
+ return usersByLogin.values();
+ }
+
+ @Override
+ @CheckForNull
+ public User user(String login) {
+ return usersByLogin.get(login);
+ }
+
+ @Override
+ public boolean securityExclusions() {
+ return securityExclusions;
+ }
+
+ @Override
+ public boolean maxResultsReached() {
+ return maxResultsReached;
+ }
+
+ @Override
+ public Paging paging() {
+ return paging;
+ }
+
+
+}
import org.sonar.api.BatchComponent;
import org.sonar.api.ServerComponent;
import org.sonar.api.issue.IssueQuery;
+import org.sonar.core.issue.DefaultIssueQueryResult;
import org.sonar.core.persistence.MyBatis;
import javax.annotation.CheckForNull;
}
@VisibleForTesting
- List<IssueDto> selectIssueAndComponentIds(IssueQuery query) {
+ List<IssueDto> selectIssueAndProjectIds(final IssueQuery query, final DefaultIssueQueryResult defaultIssueQueryResult,
+ final Collection<Integer> authorizedRootProjectIds) {
SqlSession session = mybatis.openSession();
try {
- return selectIssueAndComponentIds(query, session);
- } finally {
- MyBatis.closeQuietly(session);
- }
- }
-
- /**
- * The returned IssueDto list contains only the issue id and the resource id
- */
- public List<IssueDto> selectIssueAndComponentIds(IssueQuery query, SqlSession session) {
- IssueMapper mapper = session.getMapper(IssueMapper.class);
- return mapper.selectIssueAndComponentIds(query);
- }
-
- @VisibleForTesting
- List<IssueDto> selectIssueAndProjectIds(IssueQuery query, Collection<Integer> authorizedRootProjectIds, Integer maxResults) {
- SqlSession session = mybatis.openSession();
- try {
- return selectIssueAndProjectIds(query, authorizedRootProjectIds, maxResults, session);
+ return selectIssueAndProjectIds(query, defaultIssueQueryResult, authorizedRootProjectIds, session);
} finally {
MyBatis.closeQuietly(session);
}
/**
* The returned IssueDto list contains only the issue id, the project id and the sort column
*/
- public List<IssueDto> selectIssueAndProjectIds(final IssueQuery query, final Collection<Integer> authorizedRootProjectIds, SqlSession session) {
- return selectIssueAndProjectIds(query, authorizedRootProjectIds, query.maxResults(), session);
- }
-
- private List<IssueDto> selectIssueAndProjectIds(final IssueQuery query, final Collection<Integer> authorizedRootProjectIds, final Integer maxResults, SqlSession session) {
- final List<IssueDto> issues = newArrayList();
+ public List<IssueDto> selectIssueAndProjectIds(final IssueQuery query, final DefaultIssueQueryResult defaultIssueQueryResult,
+ final Collection<Integer> authorizedRootProjectIds, SqlSession sqlSession){
+ final List<IssueDto> authorizedIssues = newArrayList();
ResultHandler resultHandler = new ResultHandler(){
@Override
public void handleResult(ResultContext context) {
IssueDto issueDto = (IssueDto) context.getResultObject();
if (authorizedRootProjectIds.contains(issueDto.getProjectId())) {
- issues.add(issueDto);
+ authorizedIssues.add(issueDto);
} else {
- // reject because user not authorized
+ defaultIssueQueryResult.setSecurityExclusions(true);
}
- if (issues.size() >= maxResults) {
+ if (authorizedIssues.size() >= query.maxResults()) {
+ defaultIssueQueryResult.setMaxResultsReached(true);
context.stop();
}
}
};
- session.select("selectIssueAndProjectIds", query, resultHandler);
- return issues;
+ sqlSession.select("selectIssueAndProjectIds", query, resultHandler);
+ return authorizedIssues;
}
@VisibleForTesting
IssueDto selectByKey(String key);
- List<IssueDto> selectIssueAndComponentIds(IssueQuery query);
-
List<IssueDto> select(IssueQuery query);
List<IssueDto> selectNonClosedIssues(int rootComponentId);
</where>
</select>
- <select id="selectIssueAndComponentIds" parameterType="map" resultType="Issue">
- select i.id, i.resource_id as resourceId
- <include refid="selectQueryConditions"/>
- </select>
-
<select id="selectIssueAndProjectIds" parameterType="map" resultType="Issue" fetchSize="500">
select i.id, i.project_id as projectId
<include refid="sortColumn"/>
import org.sonar.api.issue.IssueQuery;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.utils.DateUtils;
+import org.sonar.core.issue.DefaultIssueQueryResult;
import org.sonar.core.persistence.AbstractDaoTestCase;
import java.util.Collections;
import static com.google.common.collect.Lists.newArrayList;
import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class IssueDaoTest extends AbstractDaoTestCase {
assertThat(dao.select(query)).hasSize(3);
}
- @Test
- public void should_select_issue_and_component_ids() {
- setupData("shared", "should_select_issue_and_component_ids");
-
- IssueQuery query = IssueQuery.builder().build();
- List<IssueDto> results = dao.selectIssueAndComponentIds(query);
- assertThat(results).hasSize(3);
- }
-
@Test
public void should_select_issue_and_project_ids() {
setupData("shared", "should_select_issue_and_project_ids");
- IssueQuery query = IssueQuery.builder().build();
- List<IssueDto> results = dao.selectIssueAndProjectIds(query, newArrayList(399), 1000);
+ DefaultIssueQueryResult defaultIssueQueryResult = new DefaultIssueQueryResult();
+ IssueQuery query = mock(IssueQuery.class);
+ when(query.maxResults()).thenReturn(1000);
+ List<IssueDto> results = dao.selectIssueAndProjectIds(query, defaultIssueQueryResult, newArrayList(399));
assertThat(results).hasSize(3);
+ assertThat(defaultIssueQueryResult.maxResultsReached()).isFalse();
+ assertThat(defaultIssueQueryResult.securityExclusions()).isFalse();
IssueDto issueDto = results.get(0);
assertThat(issueDto.getId()).isNotNull();
assertThat(issueDto.getProjectId()).isNotNull();
- results = dao.selectIssueAndProjectIds(query, newArrayList(399), 2);
- assertThat(results).hasSize(2);
-
- results = dao.selectIssueAndProjectIds(query, Collections.<Integer>emptyList(), 1000);
+ results = dao.selectIssueAndProjectIds(query, defaultIssueQueryResult, Collections.<Integer>emptyList());
assertThat(results).isEmpty();
+ assertThat(defaultIssueQueryResult.maxResultsReached()).isFalse();
+ assertThat(defaultIssueQueryResult.securityExclusions()).isTrue();
+
+ when(query.maxResults()).thenReturn(2);
+ results = dao.selectIssueAndProjectIds(query, defaultIssueQueryResult, newArrayList(399));
+ assertThat(results).hasSize(2);
+ assertThat(defaultIssueQueryResult.maxResultsReached()).isTrue();
+ assertThat(defaultIssueQueryResult.securityExclusions()).isTrue();
}
@Test
public void should_select_issue_and_project_ids_with_sort_column() {
setupData("shared", "should_select_issue_and_project_ids");
+ DefaultIssueQueryResult defaultIssueQueryResult = new DefaultIssueQueryResult();
+
IssueQuery query = IssueQuery.builder().sort(IssueQuery.Sort.ASSIGNEE).build();
- List<IssueDto> results = dao.selectIssueAndProjectIds(query, newArrayList(399), 1000);
+ List<IssueDto> results = dao.selectIssueAndProjectIds(query, defaultIssueQueryResult, newArrayList(399));
assertThat(results.get(0).getAssignee()).isNotNull();
query = IssueQuery.builder().sort(IssueQuery.Sort.SEVERITY).build();
- results = dao.selectIssueAndProjectIds(query, newArrayList(399), 1000);
+ results = dao.selectIssueAndProjectIds(query, defaultIssueQueryResult, newArrayList(399));
assertThat(results.get(0).getSeverity()).isNotNull();
query = IssueQuery.builder().sort(IssueQuery.Sort.STATUS).build();
- results = dao.selectIssueAndProjectIds(query, newArrayList(399), 1000);
+ results = dao.selectIssueAndProjectIds(query, defaultIssueQueryResult, newArrayList(399));
assertThat(results.get(0).getStatus()).isNotNull();
query = IssueQuery.builder().sort(IssueQuery.Sort.CREATION_DATE).build();
- results = dao.selectIssueAndProjectIds(query, newArrayList(399), 1000);
+ results = dao.selectIssueAndProjectIds(query, defaultIssueQueryResult, newArrayList(399));
assertThat(results.get(0).getIssueCreationDate()).isNotNull();
query = IssueQuery.builder().sort(IssueQuery.Sort.UPDATE_DATE).build();
- results = dao.selectIssueAndProjectIds(query, newArrayList(399), 1000);
+ results = dao.selectIssueAndProjectIds(query, defaultIssueQueryResult, newArrayList(399));
assertThat(results.get(0).getIssueUpdateDate()).isNotNull();
query = IssueQuery.builder().sort(IssueQuery.Sort.CLOSE_DATE).build();
- results = dao.selectIssueAndProjectIds(query, newArrayList(399), 1000);
+ results = dao.selectIssueAndProjectIds(query, defaultIssueQueryResult, newArrayList(399));
assertThat(results.get(0).getIssueCloseDate()).isNotNull();
}
List<IssueDto> results = newArrayList(dao.selectByIds(newArrayList(100l, 101l, 102l)));
assertThat(results).hasSize(3);
- assertThat(results.get(0).getId()).isEqualTo(100);
- assertThat(results.get(1).getId()).isEqualTo(101);
- assertThat(results.get(2).getId()).isEqualTo(102);
}
}
package org.sonar.server.issue;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.ibatis.session.SqlSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.component.Component;
import org.sonar.api.issue.*;
-import org.sonar.api.rule.RuleKey;
import org.sonar.api.rules.Rule;
import org.sonar.api.user.User;
import org.sonar.api.user.UserFinder;
import org.sonar.api.utils.Paging;
import org.sonar.core.issue.DefaultIssue;
import org.sonar.core.issue.DefaultIssueComment;
+import org.sonar.core.issue.DefaultIssueQueryResult;
import org.sonar.core.issue.db.IssueChangeDao;
import org.sonar.core.issue.db.IssueDao;
import org.sonar.core.issue.db.IssueDto;
import org.sonar.core.user.AuthorizationDao;
import org.sonar.server.platform.UserSession;
-import javax.annotation.CheckForNull;
-
import java.util.Collection;
import java.util.List;
import java.util.Map;
LOG.debug("IssueQuery : {}", query);
SqlSession sqlSession = myBatis.openSession();
try {
+ DefaultIssueQueryResult defaultIssueQueryResult = new DefaultIssueQueryResult();
+
// 1. Select all authorized root project ids for the user
Collection<Integer> rootProjectIds = authorizationDao.selectAuthorizedRootProjectsIds(UserSession.get().userId(), query.requiredRole(), sqlSession);
// 2. Select the authorized ids of all the issues that match the query
- List<IssueDto> authorizedIssues = issueDao.selectIssueAndProjectIds(query, rootProjectIds, sqlSession);
+ List<IssueDto> authorizedIssues = issueDao.selectIssueAndProjectIds(query, defaultIssueQueryResult, rootProjectIds, sqlSession);
// 3. Sort all authorized issues
List<IssueDto> authorizedSortedIssues = sort(authorizedIssues, query, authorizedIssues.size());
}
}
- return new DefaultResults(issues,
- findRules(ruleIds),
- findComponents(componentIds),
- findProjects(projectIds),
- findActionPlans(actionPlanKeys),
- findUsers(users),
- paging,
- false,
- authorizedIssues.size() >= query.maxResults()
- // TODO
-// authorizedIssues.size() != allIssues.size()
- );
+ defaultIssueQueryResult.setIssues(issues)
+ .addRules(findRules(ruleIds))
+ .addComponents(findComponents(componentIds))
+ .addProjects(findProjects(projectIds))
+ .addActionPlans(findActionPlans(actionPlanKeys))
+ .addUsers(findUsers(users))
+ .setPaging(paging);
+
+ return defaultIssueQueryResult;
} finally {
MyBatis.closeQuietly(sqlSession);
}
}
- private List<IssueDto> sort(List<IssueDto> issues, IssueQuery query, int allIssuesSize){
+ private List<IssueDto> sort(List<IssueDto> issues, IssueQuery query, int allIssuesSize) {
if (allIssuesSize < query.maxResults()) {
return new IssuesFinderSort(issues, query).sort();
}
return dto != null ? dto.toDefaultIssue() : null;
}
- static class DefaultResults implements IssueQueryResult {
- private final List<Issue> issues;
- private final Map<RuleKey, Rule> rulesByKey = Maps.newHashMap();
- private final Map<String, Component> componentsByKey = Maps.newHashMap();
- private final Map<String, Component> projectsByKey = Maps.newHashMap();
- private final Map<String, ActionPlan> actionPlansByKey = Maps.newHashMap();
- private final Map<String, User> usersByLogin = Maps.newHashMap();
- private final boolean securityExclusions;
- private final boolean maxResultsReached;
- private final Paging paging;
-
- DefaultResults(List<Issue> issues,
- Collection<Rule> rules,
- Collection<Component> components,
- Collection<Component> projects,
- Collection<ActionPlan> actionPlans,
- Collection<User> users,
- Paging paging, boolean securityExclusions, boolean maxResultsReached) {
- this.issues = issues;
- for (Rule rule : rules) {
- rulesByKey.put(rule.ruleKey(), rule);
- }
- for (Component component : components) {
- componentsByKey.put(component.key(), component);
- }
- for (Component project : projects) {
- projectsByKey.put(project.key(), project);
- }
- for (ActionPlan actionPlan : actionPlans) {
- actionPlansByKey.put(actionPlan.key(), actionPlan);
- }
- for (User user : users) {
- usersByLogin.put(user.login(), user);
- }
- this.paging = paging;
- this.securityExclusions = securityExclusions;
- this.maxResultsReached = maxResultsReached;
- }
-
- @Override
- public List<Issue> issues() {
- return issues;
- }
-
- @Override
- public Rule rule(Issue issue) {
- return rulesByKey.get(issue.ruleKey());
- }
-
- @Override
- public Collection<Rule> rules() {
- return rulesByKey.values();
- }
-
- @Override
- public Component component(Issue issue) {
- return componentsByKey.get(issue.componentKey());
- }
-
- @Override
- public Collection<Component> components() {
- return componentsByKey.values();
- }
-
- @Override
- public Component project(Issue issue) {
- return projectsByKey.get(issue.projectKey());
- }
-
- @Override
- public Collection<Component> projects() {
- return projectsByKey.values();
- }
-
- @Override
- public ActionPlan actionPlan(Issue issue) {
- return actionPlansByKey.get(issue.actionPlanKey());
- }
-
- @Override
- public Collection<ActionPlan> actionPlans() {
- return actionPlansByKey.values();
- }
-
- @Override
- public Collection<User> users() {
- return usersByLogin.values();
- }
-
- @Override
- @CheckForNull
- public User user(String login) {
- return usersByLogin.get(login);
- }
-
- @Override
- public boolean securityExclusions() {
- return securityExclusions;
- }
-
- @Override
- public boolean maxResultsReached() {
- return maxResultsReached;
- }
-
- @Override
- public Paging paging() {
- return paging;
- }
- }
}
import org.sonar.api.issue.IssueQueryResult;
import org.sonar.api.rules.Rule;
import org.sonar.api.user.UserFinder;
-import org.sonar.api.web.UserRole;
import org.sonar.core.component.ComponentDto;
import org.sonar.core.issue.DefaultActionPlan;
+import org.sonar.core.issue.DefaultIssueQueryResult;
import org.sonar.core.issue.db.IssueChangeDao;
import org.sonar.core.issue.db.IssueDao;
import org.sonar.core.issue.db.IssueDto;
when(issueDao.selectByIds(anyCollection(), any(SqlSession.class))).thenReturn(dtoList);
IssueQueryResult results = finder.find(query);
- verify(issueDao).selectIssueAndProjectIds(eq(query), eq(newHashSet(100)), any(SqlSession.class));
+ verify(issueDao).selectIssueAndProjectIds(eq(query), any(DefaultIssueQueryResult.class), eq(newHashSet(100)), any(SqlSession.class));
assertThat(results.issues()).hasSize(2);
Issue issue = results.issues().iterator().next();
assertThat(results.securityExclusions()).isFalse();
}
- @Test
- public void should_find_only_authorized_issues() {
- when(authorizationDao.selectAuthorizedRootProjectsIds(anyInt(), anyString(), any(SqlSession.class)))
- .thenReturn(Collections.<Integer>emptySet());
- IssueQuery query = IssueQuery.builder().pageSize(100).requiredRole(UserRole.USER).build();
-
- IssueDto issue1 = new IssueDto().setId(1L).setRuleId(50).setResourceId(123).setProjectId(100)
- .setComponentKey_unit_test_only("Action.java")
- .setProjectKey_unit_test_only("struts")
- .setRuleKey_unit_test_only("squid", "AvoidCycle")
- .setStatus("OPEN").setResolution("OPEN");
- when(issueDao.selectByIds(anyCollection(), any(SqlSession.class))).thenReturn(newArrayList(issue1));
-
- finder.find(query);
- verify(issueDao).selectIssueAndProjectIds(eq(query), eq(Collections.<Integer>emptySet()), any(SqlSession.class));
-
- // TODO
-// assertThat(results.securityExclusions()).isTrue();
- }
-
@Test
public void should_find_paginate_result() {
when(authorizationDao.selectAuthorizedRootProjectsIds(anyInt(), anyString(), any(SqlSession.class)))
.setRuleKey_unit_test_only("squid", "AvoidCycle")
.setStatus("OPEN").setResolution("OPEN");
List<IssueDto> dtoList = newArrayList(issue1, issue2);
- when(issueDao.selectIssueAndProjectIds(eq(query), eq(newHashSet(100)), any(SqlSession.class))).thenReturn(dtoList);
+ when(issueDao.selectIssueAndProjectIds(eq(query), any(DefaultIssueQueryResult.class), eq(newHashSet(100)), any(SqlSession.class))).thenReturn(dtoList);
when(issueDao.selectByIds(anyCollection(), any(SqlSession.class))).thenReturn(dtoList);
IssueQueryResult results = finder.find(query);
public void should_get_empty_result_when_no_issue() {
grantAccessRights();
IssueQuery query = IssueQuery.builder().build();
- when(issueDao.selectIssueAndProjectIds(eq(query), anyCollection(), any(SqlSession.class))).thenReturn(Collections.<IssueDto>emptyList());
+ when(issueDao.selectIssueAndProjectIds(eq(query), any(DefaultIssueQueryResult.class), anyCollection(), any(SqlSession.class))).thenReturn(Collections.<IssueDto>emptyList());
when(issueDao.selectByIds(anyCollection(), any(SqlSession.class))).thenReturn(Collections.<IssueDto>emptyList());
IssueQueryResult results = finder.find(query);
package org.sonar.server.issue;
import org.apache.commons.lang.time.DateUtils;
+import org.fest.assertions.Assertions;
import org.junit.Test;
import org.sonar.api.issue.IssueQuery;
import org.sonar.core.issue.db.IssueDto;
List<IssueDto> result = newArrayList(issuesFinderSort.sort());
- assertThat(result).hasSize(3);
- assertThat(result.get(0).getStatus()).isEqualTo("REOPENED");
- assertThat(result.get(1).getStatus()).isEqualTo("OPEN");
- assertThat(result.get(2).getStatus()).isEqualTo("CLOSED");
+ Assertions.assertThat(result).hasSize(3);
+ Assertions.assertThat(result.get(0).getStatus()).isEqualTo("REOPENED");
+ Assertions.assertThat(result.get(1).getStatus()).isEqualTo("OPEN");
+ Assertions.assertThat(result.get(2).getStatus()).isEqualTo("CLOSED");
}
@Test
List<IssueDto> result = newArrayList(issuesFinderSort.sort());
- assertThat(result).hasSize(3);
- assertThat(result.get(0).getSeverity()).isEqualTo("INFO");
- assertThat(result.get(1).getSeverity()).isEqualTo("MAJOR");
- assertThat(result.get(2).getSeverity()).isEqualTo("BLOCKER");
+ Assertions.assertThat(result).hasSize(3);
+ Assertions.assertThat(result.get(0).getSeverity()).isEqualTo("INFO");
+ Assertions.assertThat(result.get(1).getSeverity()).isEqualTo("MAJOR");
+ Assertions.assertThat(result.get(2).getSeverity()).isEqualTo("BLOCKER");
}
@Test
List<IssueDto> result = newArrayList(issuesFinderSort.sort());
- assertThat(result).hasSize(3);
- assertThat(result.get(0).getIssueCreationDate()).isEqualTo(date3);
- assertThat(result.get(1).getIssueCreationDate()).isEqualTo(date2);
- assertThat(result.get(2).getIssueCreationDate()).isEqualTo(date1);
+ Assertions.assertThat(result).hasSize(3);
+ Assertions.assertThat(result.get(0).getIssueCreationDate()).isEqualTo(date3);
+ Assertions.assertThat(result.get(1).getIssueCreationDate()).isEqualTo(date2);
+ Assertions.assertThat(result.get(2).getIssueCreationDate()).isEqualTo(date1);
}
@Test
List<IssueDto> result = newArrayList(issuesFinderSort.sort());
- assertThat(result).hasSize(3);
- assertThat(result.get(0).getIssueUpdateDate()).isEqualTo(date3);
- assertThat(result.get(1).getIssueUpdateDate()).isEqualTo(date2);
- assertThat(result.get(2).getIssueUpdateDate()).isEqualTo(date1);
+ Assertions.assertThat(result).hasSize(3);
+ Assertions.assertThat(result.get(0).getIssueUpdateDate()).isEqualTo(date3);
+ Assertions.assertThat(result.get(1).getIssueUpdateDate()).isEqualTo(date2);
+ Assertions.assertThat(result.get(2).getIssueUpdateDate()).isEqualTo(date1);
}
@Test
List<IssueDto> result = newArrayList(issuesFinderSort.sort());
- assertThat(result).hasSize(3);
- assertThat(result.get(0).getIssueCloseDate()).isEqualTo(date3);
- assertThat(result.get(1).getIssueCloseDate()).isEqualTo(date2);
- assertThat(result.get(2).getIssueCloseDate()).isEqualTo(date1);
+ Assertions.assertThat(result).hasSize(3);
+ Assertions.assertThat(result.get(0).getIssueCloseDate()).isEqualTo(date3);
+ Assertions.assertThat(result.get(1).getIssueCloseDate()).isEqualTo(date2);
+ Assertions.assertThat(result.get(2).getIssueCloseDate()).isEqualTo(date1);
}
}