aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenTest.java
diff options
context:
space:
mode:
authorKlaudio Sinani <klaudio.sinani@sonarsource.com>2022-10-26 15:16:57 +0200
committersonartech <sonartech@sonarsource.com>2022-10-28 20:03:23 +0000
commitce409098feab4f5f5ca8168cd995775e1fa32cbb (patch)
treea04c7bf89c2b7792dbed6895b6f3db0fd3171cb1 /sonar-duplications/src/test/java/org/sonar/duplications/token/TokenTest.java
parent84dfd8b586f0c458d324e815f8b09ce3b395c044 (diff)
downloadsonarqube-ce409098feab4f5f5ca8168cd995775e1fa32cbb.tar.gz
sonarqube-ce409098feab4f5f5ca8168cd995775e1fa32cbb.zip
[NO-JIRA] Fix reported code smells & bugs
Diffstat (limited to 'sonar-duplications/src/test/java/org/sonar/duplications/token/TokenTest.java')
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/token/TokenTest.java33
1 files changed, 12 insertions, 21 deletions
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenTest.java
index 21e22d7c317..3419864be98 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenTest.java
@@ -19,31 +19,22 @@
*/
package org.sonar.duplications.token;
+import org.assertj.core.api.Assertions;
import org.junit.Test;
-import static org.junit.Assert.assertThat;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-
public class TokenTest {
@Test
- public void shouldBeEqual() {
- Token firstToken = new Token("MyValue", 1, 3);
- Token secondToken = new Token("MyValue", 1, 3);
-
- assertThat(firstToken, is(secondToken));
+ public void test_equals() {
+ Token token = new Token("value_1", 1, 2);
+
+ Assertions.assertThat(token)
+ .isEqualTo(token)
+ .isNotEqualTo(null)
+ .isNotEqualTo(new Object())
+ .isNotEqualTo(new Token("value_1", 1, 0))
+ .isNotEqualTo(new Token("value_1", 0, 2))
+ .isNotEqualTo(new Token("value_2", 1, 2))
+ .isEqualTo(new Token("value_1", 1, 2));
}
-
- @Test
- public void shouldNotBeEqual() {
- Token firstToken = new Token("MyValue", 1, 3);
- Token secondToken = new Token("MySecondValue", 1, 3);
- Token thirdToken = new Token("MyValue", 3, 3);
-
- assertThat(firstToken, not(is(secondToken)));
- assertThat(firstToken, not(is(thirdToken)));
- }
-
}