fluo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubbsii <...@git.apache.org>
Subject [GitHub] incubator-fluo pull request #825: fixes #823
Date Sat, 22 Apr 2017 02:35:47 GMT
Github user ctubbsii commented on a diff in the pull request:

    https://github.com/apache/incubator-fluo/pull/825#discussion_r112800350
  
    --- Diff: modules/api/src/test/java/org/apache/fluo/api/data/BytesTest.java ---
    @@ -79,6 +79,19 @@ public void testHashSubsequence() {
       }
     
       @Test
    +  public void testPrefixSuffix() {
    +    Bytes b1 = Bytes.of("abcde");
    +    Bytes prefix = Bytes.of("ab");
    +    Bytes suffix = Bytes.of("de");
    +    Bytes mid = Bytes.of("cd");
    +
    +    Assert.assertEquals(true, b1.startsWith(prefix));
    +    Assert.assertEquals(true, b1.endsWith(suffix));
    +    Assert.assertEquals(false, b1.startsWith(mid));
    +    Assert.assertEquals(false, b1.endsWith(mid));
    --- End diff --
    
    Should use `Assert.assertTrue` and `Assert.assertFalse` instead of `Assert.assertEquals`
here.
    
    Also, a few more cases would be helpful for full coverage (these, plus yours, I *think*
cover all cases):
    ```
    true =? "".startsWith("") // trivial empty check
    true =? "".endsWith("")  // trivial empty check
    true =? "abc".startsWith("abc") // exact match
    true =? "abc".endsWith("abc") // exact match
    true =? "abc".startsWith("") // empty string exists at start
    true =? "abc".endsWith("") // empty string exists at end
    false =? "".startsWith("abc") // empty string can't start with longer string
    false =? "".endsWith("abc") // empty string can't end with longer string
    false =? "a".startsWith("abc") // regular string can't start with longer string
    false =? "a".endsWith("abc") // regular string can't end with longer string
    ```
    
    Could also check `Bytes.EMPTY` with `Bytes.of(String)` or `Bytes.of(CharSequence)`.


---
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.
---

Mime
View raw message