You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by TheRealHaui <gi...@git.apache.org> on 2017/07/26 19:11:10 UTC

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

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 <ha...@googlemail.com>
Date:   2017-07-17T23:26:06Z

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

commit 91039cb23f79921238afebbb4bff3ccbbd049e6a
Author: Michael Hausegger <ha...@googlemail.com>
Date:   2017-07-17T23:46:59Z

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

commit 04788b92e136e4e621c6b2799e2d86d52cd8f7d5
Author: Michael Hausegger <ha...@googlemail.com>
Date:   2017-07-18T18:00:31Z

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

commit 12129b2beafc74f8f04957cc52b464a3eacdd3a9
Author: Michael Hausegger <ha...@googlemail.com>
Date:   2017-07-24T18:01:34Z

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

commit b1c30952072da6a2e02d70fd3ace6c45a66e388e
Author: Michael Hausegger <ha...@googlemail.com>
Date:   2017-07-26T19:00:16Z

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

commit 6b526277650f42f5805856371b33e5f37ce36286
Author: Michael Hausegger <ha...@googlemail.com>
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] commons-text issue #58: Add tests

Posted by coveralls <gi...@git.apache.org>.
Github user coveralls commented on the issue:

    https://github.com/apache/commons-text/pull/58
  
    
    [![Coverage Status](https://coveralls.io/builds/12564700/badge)](https://coveralls.io/builds/12564700)
    
    Coverage increased (+0.06%) to 98.222% when pulling **82504951d523da304474bdc0e6cc461dcc3ed501 on TheRealHaui:add-tests** into **6773be0a357988126d22decb82e75f601d9814b9 on apache:master**.



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] commons-text issue #58: Add tests

Posted by coveralls <gi...@git.apache.org>.
Github user coveralls commented on the issue:

    https://github.com/apache/commons-text/pull/58
  
    
    [![Coverage Status](https://coveralls.io/builds/12601363/badge)](https://coveralls.io/builds/12601363)
    
    Coverage increased (+0.06%) to 98.222% when pulling **49c25105742f9dc75a1a51800799c08f4f1c8434 on TheRealHaui:add-tests** into **6773be0a357988126d22decb82e75f601d9814b9 on apache:master**.



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] commons-text issue #58: Add tests

Posted by coveralls <gi...@git.apache.org>.
Github user coveralls commented on the issue:

    https://github.com/apache/commons-text/pull/58
  
    
    [![Coverage Status](https://coveralls.io/builds/12601363/badge)](https://coveralls.io/builds/12601363)
    
    Coverage increased (+0.06%) to 98.222% when pulling **49c25105742f9dc75a1a51800799c08f4f1c8434 on TheRealHaui:add-tests** into **6773be0a357988126d22decb82e75f601d9814b9 on apache:master**.



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by PascalSchumacher <gi...@git.apache.org>.
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<String, Integer> hashMap = new HashMap();
    +      Integer integer = new Integer((-397));
    +      hashMap.put("3J/$3.L", integer);
    +      Map<CharSequence, Integer> hashMapTwo = new HashMap(hashMap);
    +      Map<CharSequence, Integer> 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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by asfgit <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] commons-text issue #58: Add tests

Posted by TheRealHaui <gi...@git.apache.org>.
Github user TheRealHaui commented on the issue:

    https://github.com/apache/commons-text/pull/58
  
    You're welcome!
    Here we go regarding the exception detection code style.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] commons-text issue #58: Add tests

Posted by PascalSchumacher <gi...@git.apache.org>.
Github user PascalSchumacher commented on the issue:

    https://github.com/apache/commons-text/pull/58
  
    Thanks! :+1: 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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