void () { FontMetrics metrics = new JLabel().getFontMetrics(new Font(Font.DIALOG, Font.PLAIN, 10)); String longString = "This is a long string that needs to be truncated. ".repeat(10000); String truncatedString = CommittedChangeListRenderer.truncateDescription(longString, metrics, 100); assertEquals("This is a long string", truncatedString); }