Created
October 3, 2010 20:16
-
-
Save unclebob/608887 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class SplitWordTests { | |
@Test | |
public void splitOneWord() throws Exception { | |
assertThat(wrap("word", 2), equalTo("wo\nrd")); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Wrapper { | |
public static String wrap(String s, int col) { | |
if (s.length() <= col) | |
return s; | |
else | |
return (s.substring(0, col) + "\n" + s.substring(col)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment