Added implementation for StringManipulation Files#14
Added implementation for StringManipulation Files#14NadavH12 wants to merge 2 commits intoSWE-CS410:mainfrom
Conversation
| return words.length; | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
This code shows good practice in terms of readability, by using specific and detailed comments before each method header in the class.
| if (string == null || string.length() == 0) | ||
| return 0; | ||
| //trim leading and ending whitespace | ||
| String copy = this.getString(); |
There was a problem hiding this comment.
Since the string is already a member of the class, there's no need to call a getter method of getString() to access it, nor is there any reason to copy the string every time -- none of these methods are mutators.
There was a problem hiding this comment.
I make a copy here because afterwards I call the String.trim() method, which removes leading and lagging whitespace. Just for the sake of not changing the original string.
| @@ -1,116 +1,197 @@ | |||
| /* Nadav Horowitz 6/3/2023 StringManipulationTest.java | |||
There was a problem hiding this comment.
Test cases meaningfully cover almost all bounds and thrown exceptions, without any padded or trivial test cases.
| assertEquals(sStings[1], "string"); | ||
| } | ||
|
|
||
| @Test |
There was a problem hiding this comment.
This whitespace test might have been better suited by a lower out-of-bounds exception test for a negative start word parameter.
ElCapitanHaddock
left a comment
There was a problem hiding this comment.
Change the getSubString whitespace test case to one checking the lower bound.
|
No description provided.