diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-05-03 09:37:55 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-05-03 09:38:16 +0200 |
commit | 53c455995c5d49b2876f334a98ddc86bbdf1c896 (patch) | |
tree | 718d726bacb3e227a79ca2757edd8a6510976d0b /sonar-core/src/test | |
parent | 6194a1a3e19cd026da8806ccf84ebc8a22524b1d (diff) | |
download | sonarqube-53c455995c5d49b2876f334a98ddc86bbdf1c896.tar.gz sonarqube-53c455995c5d49b2876f334a98ddc86bbdf1c896.zip |
SONAR-3755 Return Action plans in Issue Finder
Diffstat (limited to 'sonar-core/src/test')
2 files changed, 68 insertions, 0 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/ActionPlanIssueDaoTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/ActionPlanIssueDaoTest.java new file mode 100644 index 00000000000..8ac11e29428 --- /dev/null +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/ActionPlanIssueDaoTest.java @@ -0,0 +1,49 @@ +/* + * 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.db; + +import org.junit.Before; +import org.junit.Test; +import org.sonar.core.persistence.AbstractDaoTestCase; + +import java.util.Collection; + +import static com.google.common.collect.Lists.newArrayList; +import static org.fest.assertions.Assertions.assertThat; + +public class ActionPlanIssueDaoTest extends AbstractDaoTestCase { + + private ActionPlanIssueDao dao; + + @Before + public void createDao() { + dao = new ActionPlanIssueDao(getMyBatis()); + } + + @Test + public void should_find_by_issue_ids() { + setupData("should_find_by_issue_ids"); + + Collection<ActionPlanIssueDto> result = dao.findByIssueIds(newArrayList(250l, 251l, 252l)); + assertThat(result).hasSize(3); + assertThat(result.iterator().next().getIssueId()).isNotNull(); + } +} diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/ActionPlanIssueDaoTest/should_find_by_issue_ids.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/ActionPlanIssueDaoTest/should_find_by_issue_ids.xml new file mode 100644 index 00000000000..b68c783aa1a --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/ActionPlanIssueDaoTest/should_find_by_issue_ids.xml @@ -0,0 +1,19 @@ +<dataset> + + <action_plans id="1" project_id="1" name="SHORT_TERM" description="[null]" deadline="[null]" + user_login="igor" status="[null]" created_at="[null]" updated_at="[null]" /> + + <action_plans_issues action_plan_id="1" issue_id="250" /> + + <action_plans id="2" project_id="1" name="SHORT_TERM" description="[null]" deadline="[null]" + user_login="igor" status="[null]" created_at="[null]" updated_at="[null]" /> + + <action_plans_issues action_plan_id="2" issue_id="251" /> + <action_plans_issues action_plan_id="2" issue_id="252" /> + + <action_plans id="3" project_id="1" name="SHORT_TERM" description="[null]" deadline="[null]" + user_login="igor" status="[null]" created_at="[null]" updated_at="[null]" /> + + <action_plans_issues action_plan_id="3" issue_id="253" /> + +</dataset> |