IntToString { public String transform(int number) { boolean isNegative = false; StringBuilder sb = new StringBuilder(); if (number == 0) { return "0"; } else if (number < 0) { isNegative = true; } number = Math.abs(number); while (number > 0) { sb.append(number % 10); number /= 10; } if (isNegative) { sb.append("-"); } return sb.reverse().toString(); }  String transform(int number);  }
@Test public void shouldTransformZero() { assertEquals("0", intToString.transform(0)); }
@Test public void shouldTransformPositiveIntegersWithJustOneDigit() { assertEquals("7", intToString.transform(7)); }
@Test public void shouldTransformNegativeIntegersWithJustOneDigit() { assertEquals("-4", intToString.transform(-4)); }
@Test public void shouldTransformPositiveIntegersWithMoreThanOneDigits() { assertEquals("24", intToString.transform(24)); }
@Test public void shouldTransformNegativeIntegersWithMoreThanOneDigits() { assertEquals("-15", intToString.transform(-15)); }