commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pascalschumac...@apache.org
Subject [text] Add some unit tests to increase code coverage (closes #56).
Date Mon, 24 Jul 2017 21:17:00 GMT
Repository: commons-text
Updated Branches:
  refs/heads/master 065a2f125 -> 79ef3cdf1


Add some unit tests to increase code coverage (closes #56).


Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/79ef3cdf
Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/79ef3cdf
Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/79ef3cdf

Branch: refs/heads/master
Commit: 79ef3cdf1a931531774da378209772dfc743d84a
Parents: 065a2f1
Author: Michael Hausegger <hausegger.michael@googlemail.com>
Authored: Tue Jul 18 01:26:06 2017 +0200
Committer: Pascal Schumacher <pascalschumacher@gmx.net>
Committed: Mon Jul 24 23:16:35 2017 +0200

----------------------------------------------------------------------
 .../commons/text/AlphabetConverterTest.java     | 79 ++++++++++++++++++++
 .../commons/text/ExtendedMessageFormatTest.java | 41 +++++++++-
 .../org/apache/commons/text/StrBuilderTest.java | 26 +++++++
 .../apache/commons/text/StrSubstitutorTest.java | 67 ++++++++++++++++-
 .../LevenshteinDetailedDistanceTest.java        | 52 ++++++++++++-
 .../similarity/LevenshteinDistanceTest.java     | 17 ++++-
 .../text/similarity/LevenshteinResultsTest.java | 70 +++++++++++++++++
 7 files changed, 343 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/79ef3cdf/src/test/java/org/apache/commons/text/AlphabetConverterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/AlphabetConverterTest.java b/src/test/java/org/apache/commons/text/AlphabetConverterTest.java
index d235c0e..4ffd20c 100644
--- a/src/test/java/org/apache/commons/text/AlphabetConverterTest.java
+++ b/src/test/java/org/apache/commons/text/AlphabetConverterTest.java
@@ -18,13 +18,18 @@ package org.apache.commons.text;
 
 import java.io.UnsupportedEncodingException;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
 /**
  * Unit tests for {@link AlphabetConverter}.
  */
@@ -201,4 +206,78 @@ public class AlphabetConverterTest {
             Assert.assertEquals("Encoded '" + s + "' into '" + encoded + "', but decoded
into '" + decoded + "'", s, decoded);
         }
     }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateConverterFromCharsWithNullAndNull() {
+        Character[] characterArray = new Character[2];
+        characterArray[0] = Character.valueOf('$');
+        characterArray[1] = characterArray[0];
+
+        AlphabetConverter.createConverterFromChars(characterArray, null, null);
+    }
+
+    @Test
+    public void testCreateConverterFromCharsOne() {
+        Character[] characterArray = new Character[2];
+        characterArray[0] = new Character('5');
+        characterArray[1] = characterArray[0];
+        AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray,
characterArray, characterArray);
+
+        assertEquals(1, alphabetConverter.getEncodedCharLength());
+    }
+
+    @Test
+    public void testCreateConverterFromMapAndEquals() {
+        Map<Integer, String> hashMap = new HashMap<>();
+        AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromMap(hashMap);
+        hashMap.put(0, "CtDs");
+        AlphabetConverter alphabetConverterTwo = AlphabetConverter.createConverterFromMap(hashMap);
+
+        assertFalse(alphabetConverter.equals(alphabetConverterTwo));
+        assertEquals(1, alphabetConverter.getEncodedCharLength());
+    }
+
+    @Test
+    public void testEquals() {
+        Character[] characterArray = new Character[2];
+        Character character = new Character('R');
+        characterArray[0] = character;
+        characterArray[1] = character;
+        AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray,
characterArray, characterArray);
+        Map<Integer, String> map = new HashMap<>();
+        AlphabetConverter alphabetConverterTwo = AlphabetConverter.createConverterFromMap(map);
+
+        assertEquals(1, alphabetConverterTwo.getEncodedCharLength());
+        assertFalse(alphabetConverter.equals(alphabetConverterTwo));
+    }
+
+    @Test
+    public void testEqualsWithNull() {
+        Character[] characterArray = new Character[0];
+        AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray,
null, null);
+
+        assertFalse(alphabetConverter.equals(null));
+    }
+
+    @Test
+    public void testCreateConverterFromCharsAndEquals() {
+        Character[] characterArray = new Character[2];
+        char charOne = '+';
+        Character character = new Character('+');
+        characterArray[0] = character;
+        characterArray[1] = characterArray[0];
+        AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray,
characterArray, characterArray);
+
+        assertFalse(alphabetConverter.equals(charOne));
+    }
+
+    @Test
+    public void testDecodeReturningNull() throws UnsupportedEncodingException {
+        Map<Integer, String> map = new HashMap<>();
+        AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromMap(map);
+        alphabetConverter.decode(null);
+
+        assertEquals(1, alphabetConverter.getEncodedCharLength());
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/79ef3cdf/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java b/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java
index bc8cb06..c868a73 100644
--- a/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java
+++ b/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java
@@ -87,12 +87,12 @@ public class ExtendedMessageFormatTest {
      */
     @Test
     public void testEscapedBraces_LANG_948() {
-        // message without placeholder because braces are escaped by quotes 
+        // message without placeholder because braces are escaped by quotes
         final String pattern = "Message without placeholders '{}'";
         final ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, registry);
         assertEquals("Message without placeholders {}", emf.format(new Object[] {"DUMMY"}));
 
-        // message with placeholder because quotes are escaped by quotes 
+        // message with placeholder because quotes are escaped by quotes
         final String pattern2 = "Message with placeholder ''{0}''";
         final ExtendedMessageFormat emf2 = new ExtendedMessageFormat(pattern2, registry);
         assertEquals("Message with placeholder 'DUMMY'", emf2.format(new Object[] {"DUMMY"}));
@@ -416,6 +416,41 @@ public class ExtendedMessageFormatTest {
         emf.setFormatsByArgumentIndex(new Format[]{new LowerCaseFormat(), new UpperCaseFormat()});
     }
 
+    @Test(expected = IllegalArgumentException.class)
+    public void testFailsToCreateExtendedMessageFormatTakingTwoArgumentsThrowsIllegalArgumentExceptionOne()
{
+        new ExtendedMessageFormat("agdXdkR;T1{9 ^,LzXf?", new HashMap<String, FormatFactory>());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testFailsToCreateExtendedMessageFormatTakingTwoArgumentsThrowsIllegalArgumentExceptionTwo()
{
+        new ExtendedMessageFormat("a5XdkR;T1{9 ,LzXf?", new HashMap<String, FormatFactory>());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testFailsToCreateExtendedMessageFormatTakingTwoArgumentsThrowsIllegalArgumentExceptionThree()
{
+        new ExtendedMessageFormat("9jLh_D9{ ", new HashMap<String, FormatFactory>());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testFailsToCreateExtendedMessageFormatTakingTwoArgumentsThrowsIllegalArgumentExceptionFour()
{
+        new ExtendedMessageFormat("RD,nXhM{}{", new HashMap<String, FormatFactory>());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testFailsToCreateExtendedMessageFormatTakingTwoArgumentsThrowsIllegalArgumentExceptionFive()
{
+        new ExtendedMessageFormat("j/[_D9{0,\"&'+0o", new HashMap<String, FormatFactory>());
+    }
+
+    @Test
+    public void testCreatesExtendedMessageFormatTakingString() {
+        ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("Unterminated
format element at position ");
+        Map<String, FormatFactory> map = new HashMap<>();
+        ExtendedMessageFormat extendedMessageFormatTwo = new ExtendedMessageFormat("Unterminated
format element at position ", map);
+
+        assertEquals("Unterminated format element at position ", extendedMessageFormatTwo.toPattern());
+        assertFalse(extendedMessageFormat.equals(extendedMessageFormatTwo));
+    }
+
     // ------------------------ Test Formats ------------------------
 
     /**
@@ -491,7 +526,7 @@ public class ExtendedMessageFormatTest {
                 final Map<String, ? extends FormatFactory> registry) {
             super(pattern, locale, registry);
         }
-        
+
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/79ef3cdf/src/test/java/org/apache/commons/text/StrBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/StrBuilderTest.java b/src/test/java/org/apache/commons/text/StrBuilderTest.java
index 04d754e..9c87395 100644
--- a/src/test/java/org/apache/commons/text/StrBuilderTest.java
+++ b/src/test/java/org/apache/commons/text/StrBuilderTest.java
@@ -25,7 +25,9 @@ import java.io.Reader;
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.io.Writer;
+import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
+import java.nio.charset.Charset;
 import java.util.Arrays;
 
 /**
@@ -2103,4 +2105,28 @@ public class StrBuilderTest {
         final char ch = 'c';
         assertEquals("c" + System.lineSeparator(), sb1.appendln(ch).toString());
     }
+
+    @Test(expected=StringIndexOutOfBoundsException.class)
+    public void testAppendTakingTwoAndThreeIntsWithZeroAndAppendTakingTwoAndThreeIntsThrowsStringIndexOutOfBoundsExceptionTwo()
{
+        Charset charset = Charset.defaultCharset();
+        ByteBuffer byteBuffer = charset.encode("end < start");
+        CharBuffer charBuffer = charset.decode(byteBuffer);
+
+        new StrBuilder(630).append(charBuffer, 0, 630);
+    }
+
+    @Test(expected=StringIndexOutOfBoundsException.class)
+    public void testAppendTakingTwoAndThreeIntsThrowsStringIndexOutOfBoundsExceptionAndAppendTakingTwoAndThreeIntsThree()
{
+        Charset charset = Charset.defaultCharset();
+        ByteBuffer byteBuffer = charset.encode("asdf");
+        CharBuffer charBuffer = charset.decode(byteBuffer);
+
+        new StrBuilder().append(charBuffer, 933, 654);
+    }
+
+    @Test(expected=StringIndexOutOfBoundsException.class)
+    public void testDeleteCharAtWithNegative() {
+        new StrBuilder().deleteCharAt((-1258));
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/79ef3cdf/src/test/java/org/apache/commons/text/StrSubstitutorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/StrSubstitutorTest.java b/src/test/java/org/apache/commons/text/StrSubstitutorTest.java
index e382691..975d481 100644
--- a/src/test/java/org/apache/commons/text/StrSubstitutorTest.java
+++ b/src/test/java/org/apache/commons/text/StrSubstitutorTest.java
@@ -592,7 +592,7 @@ public class StrSubstitutorTest {
      */
     @Test
     public void testLANG1055() {
-        System.setProperty("test_key",  "test_value");
+        System.setProperty("test_key", "test_value");
 
         final String expected = StrSubstitutor.replace("test_key=${test_key}", System.getProperties());
         final String actual = StrSubstitutor.replaceSystemProperties("test_key=${test_key}");
@@ -737,4 +737,67 @@ public class StrSubstitutorTest {
         }
     }
 
-}
+    @Test
+    public void testReplaceInTakingTwoAndThreeIntsReturningFalse() {
+        Map<String, Object> hashMap = new HashMap<>();
+        StrLookup.MapStrLookup<Object> strLookup_MapStrLookup = new StrLookup.MapStrLookup<>(hashMap);
+        StrMatcher strMatcher = StrMatcher.tabMatcher();
+        StrSubstitutor strSubstitutor = new StrSubstitutor(strLookup_MapStrLookup, strMatcher,
strMatcher, 'b', strMatcher);
+
+        assertFalse(strSubstitutor.replaceIn((StringBuilder) null, 1315, (-1369)));
+        assertEquals('b', strSubstitutor.getEscapeChar());
+        assertFalse(strSubstitutor.isPreserveEscapes());
+    }
+
+    @Test
+    public void testReplaceInTakingStringBuilderWithNonNull() {
+        StrLookup<String> strLookup = StrLookup.systemPropertiesLookup();
+        StrSubstitutor strSubstitutor = new StrSubstitutor(strLookup, "b<H", "b<H",
'\'');
+        StringBuilder stringBuilder = new StringBuilder((CharSequence) "b<H");
+
+        assertEquals('\'', strSubstitutor.getEscapeChar());
+        assertFalse(strSubstitutor.replaceIn(stringBuilder));
+    }
+
+    @Test
+    public void testReplaceInTakingStringBufferWithNonNull() {
+        StrSubstitutor strSubstitutor = new StrSubstitutor(new HashMap<String, String>(),
"WV@i#y?N*[", "WV@i#y?N*[", '*');
+
+        assertFalse(strSubstitutor.isPreserveEscapes());
+        assertFalse(strSubstitutor.replaceIn(new StringBuffer("WV@i#y?N*[")));
+        assertEquals('*', strSubstitutor.getEscapeChar());
+    }
+
+    @Test
+    public void testCreatesStrSubstitutorTakingStrLookupAndCallsReplaceTakingTwoAndThreeInts()
{
+        Map<String, CharacterPredicates> map = new HashMap<>();
+        StrLookup.MapStrLookup<CharacterPredicates> strLookup_MapStrLookup = new StrLookup.MapStrLookup<>(map);
+        StrSubstitutor strSubstitutor = new StrSubstitutor(strLookup_MapStrLookup);
+
+        assertNull(strSubstitutor.replace((CharSequence) null, 0, 0));
+        assertEquals('$', strSubstitutor.getEscapeChar());
+    }
+
+    @Test
+    public void testReplaceTakingCharSequenceReturningNull() {
+        StrSubstitutor strSubstitutor = new StrSubstitutor((StrLookup<?>) null);
+
+        assertNull( strSubstitutor.replace((CharSequence) null) );
+        assertFalse(strSubstitutor.isPreserveEscapes());
+        assertEquals('$', strSubstitutor.getEscapeChar());
+    }
+
+    @Test(expected=NullPointerException.class)
+    public void testReplaceTakingThreeArgumentsThrowsNullPointerException() {
+        StrSubstitutor.replace(null, (Properties) null);
+    }
+
+    @Test
+    public void testReplaceInTakingStringBuilderWithNull() {
+        Map<String, Object> map = new HashMap<>();
+        StrSubstitutor strSubstitutor = new StrSubstitutor(map, "", "", 'T', "K+<'f");
+
+        assertFalse(strSubstitutor.replaceIn((StringBuilder) null));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-text/blob/79ef3cdf/src/test/java/org/apache/commons/text/similarity/LevenshteinDetailedDistanceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/similarity/LevenshteinDetailedDistanceTest.java
b/src/test/java/org/apache/commons/text/similarity/LevenshteinDetailedDistanceTest.java
index 93eea39..590fe08 100644
--- a/src/test/java/org/apache/commons/text/similarity/LevenshteinDetailedDistanceTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/LevenshteinDetailedDistanceTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.text.similarity;
 
 import static org.junit.Assert.assertEquals;
 
+import org.apache.commons.text.StrBuilder;
 import org.junit.Test;
 
 public class LevenshteinDetailedDistanceTest {
@@ -399,4 +400,53 @@ public class LevenshteinDetailedDistanceTest {
     public void testConstructorWithNegativeThreshold() throws Exception {
         new LevenshteinDetailedDistance(-1);
     }
-}
+
+    @Test
+    public void testGetDefaultInstanceOne() {
+        LevenshteinDetailedDistance levenshteinDetailedDistance = LevenshteinDetailedDistance.getDefaultInstance();
+        LevenshteinResults levenshteinResults = levenshteinDetailedDistance.apply("Distance:
-2147483643, Insert: 0, Delete: 0, Substitute: 0", "Distance: 0, Insert: 2147483536, Delete:
0, Substitute: 0");
+
+        assertEquals(21, (int) levenshteinResults.getDistance());
+    }
+
+    @Test
+    public void testGetDefaultInstanceTwo() {
+        LevenshteinDetailedDistance levenshteinDetailedDistance = LevenshteinDetailedDistance.getDefaultInstance();
+        LevenshteinResults levenshteinResults = levenshteinDetailedDistance.apply("Distance:
2147483647, Insert: 0, Delete: 0, Substitute: 0", "Distance: 0, Insert: 2147483647, Delete:
0, Substitute: 0");
+
+        assertEquals(20, (int) levenshteinResults.getDistance());
+    }
+
+    @Test
+    public void testCreatesLevenshteinDetailedDistanceTakingInteger6() {
+        LevenshteinDetailedDistance levenshteinDetailedDistance = new LevenshteinDetailedDistance(0);
+        LevenshteinResults levenshteinResults = levenshteinDetailedDistance.apply("", "Distance:
38, Insert: 0, Delete: 0, Substitute: 0");
+
+        assertEquals(0, (int) levenshteinResults.getSubstituteCount());
+        assertEquals(0, (int) levenshteinResults.getDeleteCount());
+
+        assertEquals(0, (int) levenshteinResults.getInsertCount());
+        assertEquals(-1, (int) levenshteinResults.getDistance());
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testApplyThrowsIllegalArgumentExceptionAndCreatesLevenshteinDetailedDistanceTakingInteger()
{
+        LevenshteinDetailedDistance levenshteinDetailedDistance = new LevenshteinDetailedDistance(0);
+        CharSequence charSequence = new StrBuilder();
+
+        levenshteinDetailedDistance.apply(charSequence, null);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testApplyWithNull() {
+        new LevenshteinDetailedDistance(0).apply(null, null);
+    }
+
+    @Test
+    public void testGetThreshold() {
+        LevenshteinDetailedDistance levenshteinDetailedDistance = new LevenshteinDetailedDistance(0);
+
+        assertEquals(0, (int) levenshteinDetailedDistance.getThreshold());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-text/blob/79ef3cdf/src/test/java/org/apache/commons/text/similarity/LevenshteinDistanceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/similarity/LevenshteinDistanceTest.java
b/src/test/java/org/apache/commons/text/similarity/LevenshteinDistanceTest.java
index d40b8cf..6f2588f 100644
--- a/src/test/java/org/apache/commons/text/similarity/LevenshteinDistanceTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/LevenshteinDistanceTest.java
@@ -16,10 +16,11 @@
  */
 package org.apache.commons.text.similarity;
 
-import static org.junit.Assert.assertEquals;
-
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
 /**
  * Unit tests for {@link LevenshteinDistance}.
  */
@@ -136,4 +137,14 @@ public class LevenshteinDistanceTest {
         new LevenshteinDistance(-1);
     }
 
-}
+    @Test(expected = IllegalArgumentException.class)
+    public void testApplyThrowsIllegalArgumentExceptionAndCreatesLevenshteinDistanceTakingInteger()
{
+        new LevenshteinDistance(0).apply(null, null);
+    }
+
+    @Test
+    public void testGetThresholdDirectlyAfterObjectInstantiation() {
+        assertNull(new LevenshteinDistance().getThreshold());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-text/blob/79ef3cdf/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java
b/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java
new file mode 100644
index 0000000..1c0aac6
--- /dev/null
+++ b/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.text.similarity;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class LevenshteinResultsTest {
+
+    @Test
+    public void testEqualsReturningFalse() {
+        Integer integerOne = new Integer(1662);
+        Integer integerTwo = new Integer(1164);
+        LevenshteinResults levenshteinResults = new LevenshteinResults(integerOne, integerOne,
integerOne, integerOne);
+        LevenshteinResults levenshteinResultsTwo = new LevenshteinResults(integerOne, integerOne,
integerTwo, integerTwo);
+
+        assertFalse(levenshteinResults.equals(levenshteinResultsTwo));
+    }
+
+    @Test
+    public void testEqualsWithNonNull() {
+        Integer integer = new Integer(1);
+        LevenshteinResults levenshteinResults = new LevenshteinResults(null, integer, integer,
null);
+        LevenshteinResults levenshteinResultsTwo = new LevenshteinResults(null, null, null,
null);
+
+        assertFalse(levenshteinResults.equals(levenshteinResultsTwo));
+    }
+
+    @Test
+    public void testEqualsWithNull() {
+        Integer integer = new Integer((-647));
+        LevenshteinResults levenshteinResults = new LevenshteinResults(integer, null, null,
integer);
+
+        assertFalse(levenshteinResults.equals(null));
+    }
+
+    @Test
+    public void testEqualsDifferenceInSubstitutionCount() {
+        Integer integer = new Integer(1662);
+        LevenshteinResults levenshteinResults = new LevenshteinResults(integer, integer,
integer, integer);
+        LevenshteinResults levenshteinResultsTwo = new LevenshteinResults(integer, integer,
integer, null);
+
+        assertFalse(levenshteinResults.equals(levenshteinResultsTwo));
+    }
+
+    @Test
+    public void testEqualsSameObject() {
+        Integer integer = new Integer(1662);
+        LevenshteinResults levenshteinResults = new LevenshteinResults(integer, integer,
integer, null);
+
+        assertTrue(levenshteinResults.equals(levenshteinResults));
+    }
+
+}
\ No newline at end of file


Mime
View raw message