diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2014-01-19 22:28:56 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2014-01-19 22:28:56 +0100 |
commit | 3104c1c7bb11b869157c9b84657da8605842b000 (patch) | |
tree | 6e5b856c6282a9bf70bf337042b21411417a34de /sonar-plugin-api | |
parent | 7e93f91f06dc47fcda0f69ece9ed284e6489ef10 (diff) | |
download | sonarqube-3104c1c7bb11b869157c9b84657da8605842b000.tar.gz sonarqube-3104c1c7bb11b869157c9b84657da8605842b000.zip |
Refactor ProjectLinkTest
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/resources/ProjectLinkTest.java | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/ProjectLinkTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/ProjectLinkTest.java index 6b70b7d3aa0..4e5d204bf0f 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/ProjectLinkTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/ProjectLinkTest.java @@ -19,18 +19,13 @@ */ package org.sonar.api.resources; -import org.junit.Before; import org.junit.Test; -import org.sonar.api.BaseModelTestCase; -public class ProjectLinkTest extends BaseModelTestCase { +import static org.junit.Assert.assertEquals; - private ProjectLink link; +public class ProjectLinkTest { - @Before - public void setUp() throws Exception { - link = new ProjectLink(); - } + ProjectLink link = new ProjectLink(); @Test public void testSetName() { @@ -47,10 +42,22 @@ public class ProjectLinkTest extends BaseModelTestCase { @Test public void testConstructor() { link = new ProjectLink("home", - overFillString(ProjectLink.NAME_COLUMN_SIZE), - overFillString(ProjectLink.HREF_COLUMN_SIZE)); + overFillString(ProjectLink.NAME_COLUMN_SIZE), + overFillString(ProjectLink.HREF_COLUMN_SIZE)); assertAbbreviated(ProjectLink.NAME_COLUMN_SIZE, link.getName()); assertAbbreviated(ProjectLink.HREF_COLUMN_SIZE, link.getHref()); } + private String overFillString(int maxSize) { + StringBuilder overFilled = new StringBuilder(); + for (int i = 0; i < 50 + maxSize; i++) { + overFilled.append("x"); + } + return overFilled.toString(); + } + + private void assertAbbreviated(int maxSize, String value) { + assertEquals(maxSize, value.length()); + assertEquals('.', value.charAt(maxSize - 1)); + } } |