diff options
Diffstat (limited to 'sonar-server/src/test/java/org/sonar/server')
3 files changed, 67 insertions, 1 deletions
diff --git a/sonar-server/src/test/java/org/sonar/server/issue/DefaultIssueFinderTest.java b/sonar-server/src/test/java/org/sonar/server/issue/DefaultIssueFinderTest.java index 1ed91d8bbbf..5dbff1a591a 100644 --- a/sonar-server/src/test/java/org/sonar/server/issue/DefaultIssueFinderTest.java +++ b/sonar-server/src/test/java/org/sonar/server/issue/DefaultIssueFinderTest.java @@ -29,6 +29,7 @@ import org.sonar.api.issue.IssueQuery; import org.sonar.api.issue.IssueQueryResult; import org.sonar.api.issue.internal.DefaultIssue; import org.sonar.api.rules.Rule; +import org.sonar.api.technicaldebt.TechnicalDebt; import org.sonar.api.user.User; import org.sonar.api.user.UserFinder; import org.sonar.core.component.ComponentDto; @@ -285,4 +286,26 @@ public class DefaultIssueFinderTest { assertThat(results.actionPlans()).isEmpty(); } + @Test + public void should_find_issue_with_technical_debt() { + IssueQuery query = IssueQuery.builder().build(); + + IssueDto issue = new IssueDto().setId(1L).setRuleId(50).setComponentId(123l).setRootComponentId(100l) + .setComponentKey_unit_test_only("Action.java") + .setRootComponentKey_unit_test_only("struts") + .setRuleKey_unit_test_only("squid", "AvoidCycle") + .setStatus("OPEN").setResolution("OPEN") + .setTechnicalDebt(10L) + ; + List<IssueDto> dtoList = newArrayList(issue); + when(issueDao.selectByIds(anyCollection(), any(SqlSession.class))).thenReturn(dtoList); + + IssueQueryResult results = finder.find(query); + verify(issueDao).selectIssueIds(eq(query), anyInt(), any(SqlSession.class)); + + assertThat(results.issues()).hasSize(1); + DefaultIssue result = (DefaultIssue) results.issues().iterator().next(); + assertThat(result.technicalDebt()).isEqualTo(TechnicalDebt.of(10, 0, 0)); + } + } diff --git a/sonar-server/src/test/java/org/sonar/server/issue/InternalRubyIssueServiceTest.java b/sonar-server/src/test/java/org/sonar/server/issue/InternalRubyIssueServiceTest.java index 658b3155ec4..eb3fc3c561d 100644 --- a/sonar-server/src/test/java/org/sonar/server/issue/InternalRubyIssueServiceTest.java +++ b/sonar-server/src/test/java/org/sonar/server/issue/InternalRubyIssueServiceTest.java @@ -64,7 +64,7 @@ public class InternalRubyIssueServiceTest { ResourceDto project = new ResourceDto().setKey("org.sonar.Sample"); when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(project); service = new InternalRubyIssueService(issueService, commentService, changelogService, actionPlanService, issueStatsFinder, resourceDao, actionService, - issueFilterService, issueBulkChangeService, null); + issueFilterService, issueBulkChangeService); } @Test diff --git a/sonar-server/src/test/java/org/sonar/server/technicaldebt/RubyDebtServiceTest.java b/sonar-server/src/test/java/org/sonar/server/technicaldebt/RubyDebtServiceTest.java new file mode 100644 index 00000000000..65a9f7753e3 --- /dev/null +++ b/sonar-server/src/test/java/org/sonar/server/technicaldebt/RubyDebtServiceTest.java @@ -0,0 +1,43 @@ +/* + * 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.server.technicaldebt; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class RubyDebtServiceTest { + + + private RubyDebtService service; + + @Before + public void before() { + service = new RubyDebtService(); + } + + @Test + public void test(){ + + } + +} |