diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2012-02-12 20:44:41 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2012-02-13 11:42:13 +0400 |
commit | e0589ad21f8cb45b38c9879a44f73ad6aafeb618 (patch) | |
tree | f890ab74bdb8b930b944edcf83ec5ba1c9568ac8 /sonar-duplications/src/test/java/org/sonar/duplications/block/BlockTest.java | |
parent | c2cb97c242b64f0815d01ed5fa193fffadc97bca (diff) | |
download | sonarqube-e0589ad21f8cb45b38c9879a44f73ad6aafeb618.tar.gz sonarqube-e0589ad21f8cb45b38c9879a44f73ad6aafeb618.zip |
Remove deprecated and unused code
Diffstat (limited to 'sonar-duplications/src/test/java/org/sonar/duplications/block/BlockTest.java')
-rw-r--r-- | sonar-duplications/src/test/java/org/sonar/duplications/block/BlockTest.java | 56 |
1 files changed, 3 insertions, 53 deletions
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockTest.java index fd86e55c699..71477b0c6eb 100644 --- a/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockTest.java +++ b/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockTest.java @@ -21,8 +21,9 @@ package org.sonar.duplications.block; import org.junit.Test; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.sameInstance; +import static org.junit.Assert.assertThat; public class BlockTest { @@ -48,55 +49,4 @@ public class BlockTest { assertThat(block.getEndUnit(), is(5)); } - @Test - public void fieldsTest() { - String fileName = "someFile"; - int statementIndex = 4; - ByteArray hash = new ByteArray(12345); - Block tuple = new Block(fileName, hash, statementIndex, 0, 10); - assertThat(tuple.getResourceId(), equalTo(fileName)); - assertThat(tuple.getIndexInFile(), equalTo(statementIndex)); - assertEquals(tuple.getBlockHash(), hash); - } - - @Test - public void tupleEqualsTest() { - Block tuple1 = new Block("somefile", new ByteArray(123), 1, 1, 10); - Block tuple2 = new Block("somefile", new ByteArray(123), 1, 1, 10); - Block tupleArr = new Block("somefile", new ByteArray(333), 1, 1, 10); - Block tupleIndex = new Block("somefile", new ByteArray(123), 2, 1, 10); - Block tupleName = new Block("other", new ByteArray(123), 1, 1, 10); - - assertTrue(tuple1.equals(tuple2)); - assertThat(tuple1.toString(), is(tuple2.toString())); - - assertFalse(tuple1.equals(tupleArr)); - assertThat(tuple1.toString(), not(equalTo(tupleArr.toString()))); - - assertFalse(tuple1.equals(tupleIndex)); - assertThat(tuple1.toString(), not(equalTo(tupleIndex.toString()))); - - assertFalse(tuple1.equals(tupleName)); - assertThat(tuple1.toString(), not(equalTo(tupleName.toString()))); - } - - @Test - public void hashCodeTest() { - String[] files = {"file1", "file2"}; - int[] unitIndexes = {1, 2}; - ByteArray[] arrays = {new ByteArray(123), new ByteArray(321)}; - - // fileName is in hashCode() - int defaultTupleHashCode = new Block(files[0], arrays[0], unitIndexes[0], 1, 10).hashCode(); - int fileNameTupleHashCode = new Block(files[1], arrays[0], unitIndexes[0], 1, 10).hashCode(); - assertThat(defaultTupleHashCode, not(equalTo(fileNameTupleHashCode))); - - // statementIndex is in hashCode() - int indexTupleHashCode = new Block(files[0], arrays[0], unitIndexes[1], 1, 10).hashCode(); - assertThat(defaultTupleHashCode, not(equalTo(indexTupleHashCode))); - - // sequenceHash is in hashCode() - int sequenceHashTupleHashCode = new Block(files[0], arrays[1], unitIndexes[0], 1, 10).hashCode(); - assertThat(defaultTupleHashCode, not(equalTo(sequenceHashTupleHashCode))); - } } |