[GitHub] commons-text pull request #58: Add tests

2017-07-30 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/commons-text/pull/58


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-text pull request #58: Add tests

2017-07-27 Thread PascalSchumacher
Github user PascalSchumacher commented on a diff in the pull request:

https://github.com/apache/commons-text/pull/58#discussion_r129910754
  
--- Diff: 
src/test/java/org/apache/commons/text/similarity/CosineSimilarityTest.java ---
@@ -0,0 +1,82 @@
+/*
+ * 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 java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link CosineSimilarity}.
+ *
+ * @date 2017-07-26
+ * @see CosineSimilarity
+ *
+ **/
+public class CosineSimilarityTest{
+
+  @Test
+  public void testCosineSimilarityWithNonEmptyMap() {
+  CosineSimilarity cosineSimilarity = new CosineSimilarity();
+  Map hashMap = new HashMap();
+  Integer integer = new Integer((-397));
+  hashMap.put("3J/$3.L", integer);
+  Map hashMapTwo = new HashMap(hashMap);
+  Map hashMapThree = new HashMap();
+
+  assertEquals(0.0, (double) 
cosineSimilarity.cosineSimilarity(hashMapTwo, hashMapThree), 0.01);
+  }
+
+  @Test
--- End diff --

I think these tests should just use 
`@Test(expected=IllegalArgumentException.class)` instead fo the try-catch-fail 
construct. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-text pull request #58: Add tests

2017-07-26 Thread TheRealHaui
GitHub user TheRealHaui opened a pull request:

https://github.com/apache/commons-text/pull/58

Add tests

Created Unit Tests which cover previously uncovered lines and which I want 
to contribute.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/TheRealHaui/commons-text add-tests

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-text/pull/58.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #58


commit acad335ca6c2c08644063ab0dc0be1e8233d430e
Author: Michael Hausegger 
Date:   2017-07-17T23:26:06Z

add-some-Unit Tests Created Unit Tests to increase code coverage.

commit 91039cb23f79921238afebbb4bff3ccbbd049e6a
Author: Michael Hausegger 
Date:   2017-07-17T23:46:59Z

add-some-Unit Tests Added license header to new test class file.

commit 04788b92e136e4e621c6b2799e2d86d52cd8f7d5
Author: Michael Hausegger 
Date:   2017-07-18T18:00:31Z

add-some-Unit-Tests Reformatted various code artifacts.

commit 12129b2beafc74f8f04957cc52b464a3eacdd3a9
Author: Michael Hausegger 
Date:   2017-07-24T18:01:34Z

add-some-Unit-Tests Corrected required code fragments.

commit b1c30952072da6a2e02d70fd3ace6c45a66e388e
Author: Michael Hausegger 
Date:   2017-07-26T19:00:16Z

add-Tests Added Unit Tests that cover previously uncovered lines.

commit 6b526277650f42f5805856371b33e5f37ce36286
Author: Michael Hausegger 
Date:   2017-07-26T19:05:00Z

Merge remote-tracking branch 'upstream/master' into add-tests

# Conflicts:
#   src/test/java/org/apache/commons/text/AlphabetConverterTest.java
#   src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java
#   src/test/java/org/apache/commons/text/StrBuilderTest.java
#   src/test/java/org/apache/commons/text/StrSubstitutorTest.java
#   
src/test/java/org/apache/commons/text/similarity/LevenshteinDetailedDistanceTest.java
#   
src/test/java/org/apache/commons/text/similarity/LevenshteinDistanceTest.java




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org