aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/ProjectLinkTest.java27
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));
+ }
}