### Question:
StringUtils { public static String padding(int repeat, char padChar) throws IndexOutOfBoundsException { if (repeat < 0) { throw new IndexOutOfBoundsException("Cannot pad a negative amount: " + repeat); } final char[] buf = new char[repeat]; for (int i = 0; i < buf.length; i++) { buf[i] = padChar; } return new String(buf); }  static boolean isEmpty(String str); static String leftPad(String str, int size); static String leftPad(String str, int size, char padChar); static String leftPad(String str, int size, String padStr); static String padding(int repeat, char padChar);  }### Answer:
@Test public void padding() { Assert.assertEquals("", padding(0, 'e')); Assert.assertEquals("eee", padding(3, 'e')); try { padding(-2, 'e'); Assert.fail("Expected IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { Assert.assertTrue(e.getMessage().contains("Cannot pad a negative amount:")); } }