void () { FontMetrics metrics = new JLabel().getFontMetrics(new Font(Font.DIALOG, Font.PLAIN, 10)); String longString = "Thisisalongstringwithoutspaces".repeat(100); String truncatedString = CommittedChangeListRenderer.truncateDescription(longString, metrics, 100000); assertEquals("Thisisalongstringwithoutspaces".repeat(100), truncatedString); }