Skip to content
This repository has been archived by the owner on Jul 8, 2019. It is now read-only.

Commit

Permalink
Adding tests for models
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablissimo committed Jan 24, 2015
1 parent e3ffcec commit 822d386
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void addRule_with_boolean_creates_rule() {
this.model.addRule("the rule", true);

assertTrue(this.model.getRules().containsKey("the rule"));
assertEquals(this.model.getRules().get("the rule"), true);
assertEquals(true, this.model.getRules().get("the rule"));
}

@Test
Expand Down
52 changes: 52 additions & 0 deletions src/test/java/com/pablissimo/sonar/model/TsLintIssueTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.pablissimo.sonar.model;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class TsLintIssueTest {
TsLintIssue model;

@Before
public void setUp() throws Exception {
this.model = new TsLintIssue();
}

@After
public void tearDown() throws Exception {
}

@Test
public void getSetFilename() {
this.model.setFileName("the file");
assertEquals("the file", this.model.getFileName());
}

@Test
public void getSetStartPosition() {
TsLintPosition startPosition = new TsLintPosition();
this.model.setStartPosition(startPosition);
assertEquals(startPosition, this.model.getStartPosition());
}

@Test
public void getSetEndPosition() {
TsLintPosition endPosition = new TsLintPosition();
this.model.setEndPosition(endPosition);
assertEquals(endPosition, this.model.getEndPosition());
}

@Test
public void getSetFailure() {
this.model.setFailure("the failure");
assertEquals("the failure", this.model.getFailure());
}

@Test
public void getSetRuleName() {
this.model.setRuleName("the rule");
assertEquals("the rule", this.model.getRuleName());
}
}
38 changes: 38 additions & 0 deletions src/test/java/com/pablissimo/sonar/model/TsLintPositionTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.pablissimo.sonar.model;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class TsLintPositionTest {
TsLintPosition model;

@Before
public void setUp() throws Exception {
this.model = new TsLintPosition();
}

@After
public void tearDown() throws Exception {
}

@Test
public void getSetPosition() {
this.model.setPosition(123);
assertEquals(123, this.model.getPosition());
}

@Test
public void getSetLine() {
this.model.setLine(234);
assertEquals(234, this.model.getLine());
}

@Test
public void getSetCharacter() {
this.model.setCharacter(345);
assertEquals(345, this.model.getCharacter());
}
}

0 comments on commit 822d386

Please sign in to comment.