Justify { public static String wrapAndJustify(final String text, final int width) { final Justify justify = new Justify(width); return justify.wrapAndJustify(text); } Justify(final int width); static String wrapAndJustify(final String text, final int width);  }
@Test public void test120() throws Exception { final String justified = Justify.wrapAndJustify(source, 120); final String expected = "" + "There are two different ways for rsync to contact a remote system: using a remote-shell program as the transport (such\n" + "as ssh or rsh) or contacting an rsync daemon directly via TCP. The remote-shell transport is used whenever the source or\n" + "destination path contains a single colon (:) separator after a host specification. Contacting an rsync daemon directly\n" + "happens when the source or destination path contains a double colon (::) separator after a host specification, OR when\n" + "an rsync: "exception to this latter rule)."; Assert.assertEquals(expected, justified); }
@Test public void test79() throws Exception { final String justified = Justify.wrapAndJustify(source, 79); final String expected = "" + "There are two different ways for rsync to contact a remote system: using a\n" + "remote-shell program as the transport (such as ssh or rsh) or contacting an\n" + "rsync daemon directly via TCP. The remote-shell transport is used whenever the\n" + "source or destination path contains a single colon (:) separator after a host\n" + "specification. Contacting an rsync daemon directly happens when the source or\n" + "destination path contains a double colon (::) separator after a host\n" + "specification, OR when an rsync: "RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION\" section for an exception\n" + "to this latter rule)."; Assert.assertEquals(expected, justified); }