commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ki...@apache.org
Subject [2/2] [text] Formatting, code style and comments
Date Sun, 12 Apr 2015 09:54:23 GMT
Formatting, code style and comments


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

Branch: refs/heads/NEW-METRICS
Commit: e99b839ad6fc023dd57519e07b8a2f36e2b58b39
Parents: e00d85b
Author: Bruno P. Kinoshita <brunodepaulak@yahoo.com.br>
Authored: Sun Apr 12 21:54:11 2015 +1200
Committer: Bruno P. Kinoshita <brunodepaulak@yahoo.com.br>
Committed: Sun Apr 12 21:54:11 2015 +1200

----------------------------------------------------------------------
 .../text/similarity/CosineDistanceTest.java      | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/e99b839a/src/test/java/org/apache/commons/text/similarity/CosineDistanceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/similarity/CosineDistanceTest.java b/src/test/java/org/apache/commons/text/similarity/CosineDistanceTest.java
index ce33572..0d6879a 100644
--- a/src/test/java/org/apache/commons/text/similarity/CosineDistanceTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/CosineDistanceTest.java
@@ -26,18 +26,29 @@ import org.junit.Test;
 
 /**
  * Unit tests for {@link org.apache.commons.text.similarity.CosineSimilarity}.
+ *
+ * @since 0.1
  */
 public class CosineDistanceTest {
 
+    /**
+     * Cosine distance under test.
+     */
     private static CosineDistance cosineDistance;
 
+    /**
+     * Creates the cosine distance object used throughout the tests.
+     */
     @BeforeClass
     public static void setUp() {
         cosineDistance = new CosineDistance();
     }
 
+    /**
+     * Tests the cosine distance with several inputs.
+     */
     @Test
-    public void testCosineSimilarity() {
+    public void testCosineDistance() {
         assertEquals(Double.valueOf(0.5d), roundValue(cosineDistance.compare("the house",
"da house")));
         assertEquals(Double.valueOf(0.0d), roundValue(cosineDistance.compare("AB", "AB")));
         assertEquals(Double.valueOf(1.0d), roundValue(cosineDistance.compare("AB", "BA")));
@@ -48,6 +59,12 @@ public class CosineDistanceTest {
 
     // --- Utility methods
 
+    /**
+     * Rounds up a value.
+     *
+     * @param value a value
+     * @return rounded up value
+     */
     private Double roundValue(Double value) {
         return (Double) new BigDecimal(value).setScale(2, RoundingMode.HALF_UP).doubleValue();
     }


Mime
View raw message