Adding a junit test for LuceneResultStructImpl
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/5c09e688 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/5c09e688 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/5c09e688 Branch: refs/heads/develop Commit: 5c09e6886801ba925a6107d6b1412fc4cfc2ed32 Parents: 8b56020 Author: Dan Smith <[email protected]> Authored: Fri Oct 16 13:04:47 2015 -0700 Committer: Dan Smith <[email protected]> Committed: Fri Oct 16 13:54:53 2015 -0700 ---------------------------------------------------------------------- .../LuceneResultStructImpJUnitTest.java | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5c09e688/gemfire-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneResultStructImpJUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneResultStructImpJUnitTest.java b/gemfire-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneResultStructImpJUnitTest.java new file mode 100644 index 0000000..bc9ad33 --- /dev/null +++ b/gemfire-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneResultStructImpJUnitTest.java @@ -0,0 +1,32 @@ +package com.gemstone.gemfire.cache.lucene.internal; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import com.gemstone.gemfire.test.junit.categories.UnitTest; + +@Category(UnitTest.class) +public class LuceneResultStructImpJUnitTest { + + @Test + public void hashCodeAndEquals() { + + //Create 2 equal structs + LuceneResultStructImpl<String, String> result1 = new LuceneResultStructImpl<String, String>("key1", "value1", 5); + LuceneResultStructImpl<String, String> result2 = new LuceneResultStructImpl<String, String>("key1", "value1", 5); + assertEquals(result1, result1); + assertEquals(result1, result2); + assertEquals(result1.hashCode(), result2.hashCode()); + + //And some unequal ones + LuceneResultStructImpl<String, String> result3 = new LuceneResultStructImpl<String, String>("key2", "value1", 5); + LuceneResultStructImpl<String, String> result4 = new LuceneResultStructImpl<String, String>("key1", "value2", 5); + LuceneResultStructImpl<String, String> result5 = new LuceneResultStructImpl<String, String>("key1", "value1", 6); + assertNotEquals(result1, result3); + assertNotEquals(result1, result4); + assertNotEquals(result1, result5); + } + +}
