File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/test/java/com/thealgorithms/strings Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 11package com .thealgorithms .strings ;
22
3+ import org .junit .jupiter .api .Test ;
4+
5+ import static org .junit .jupiter .api .Assertions .assertEquals ;
6+
37public class LengthOfLastWordTest {
8+ @ Test
9+ public void testLengthOfLastWord () {
10+ assertEquals (5 , new LengthOfLastWord ().lengthOfLastWord ("Hello World" ));
11+ assertEquals (4 , new LengthOfLastWord ().lengthOfLastWord (" fly me to the moon " ));
12+ assertEquals (6 , new LengthOfLastWord ().lengthOfLastWord ("luffy is still joyboy" ));
13+ assertEquals (5 , new LengthOfLastWord ().lengthOfLastWord ("Hello" ));
14+ assertEquals (0 , new LengthOfLastWord ().lengthOfLastWord (" " ));
15+ assertEquals (0 , new LengthOfLastWord ().lengthOfLastWord ("" ));
16+ assertEquals (3 , new LengthOfLastWord ().lengthOfLastWord ("JUST LIE " ));
17+ }
418}
You can’t perform that action at this time.
0 commit comments