### Question:
PaddingFunction implements Function<Object, String> { @Override public String apply(Object toPad) { checkNotNull(toPad, "Can't pad null"); return paddingType.pad(toPad, minimumLength, padChar); } private  PaddingFunction(@Nonnull PaddingType paddingType, int minimumLength, char padChar); static PaddingFunction padStart(int minimumLength, char padChar); static PaddingFunction padEnd(int minimumLength, char padChar); @Override String apply(Object toPad);  }### Answer:
@Test public void shouldPadStartOfShorterStringWiZeros() { String padded = leftPaddingFunction.apply(123); assertThat(padded, is("00123")); }
@Test public void shouldNotPadStringThatAlreadyHasRequiredLength() { String padded = leftPaddingFunction.apply(12345); assertThat(padded, is("12345")); }
@Test public void shouldNotPadStringThatIsLongerThanRequiredMinimum() { String padded = leftPaddingFunction.apply(1234567); assertThat(padded, is("1234567")); }
@Test public void shouldPadEndOfShorterStringWiZeros() { String padded = rightPaddingFunction.apply("AB"); assertThat(padded, is("AB00")); }
@Test public void shouldNotRightPadStringThatAlreadyHasRequiredLength() { String padded = rightPaddingFunction.apply("ABCD"); assertThat(padded, is("ABCD")); }
@Test public void shouldNotRightPadStringThatIsLongerThanRequiredMinimum() { String padded = rightPaddingFunction.apply("ABCDEFGH"); assertThat(padded, is("ABCDEFGH")); }
@Test public void shouldFailWhenNullIsPassedIn() { expectedException.expect(NullPointerException.class); expectedException.expectMessage("Can't pad null"); rightPaddingFunction.apply(null); }