@Test public void should_add_spaces() { StringWidthAdapter stringWidthAdapter = new StringWidthAdapter(3); assertThat(stringWidthAdapter.adapt("s")).isEqualTo("s "); }
String adapt(String string) { String spacesToAdd = ""; int stringLength = string.length(); if(stringLength < expectedStringSize) { for (int i = 0; i < expectedStringSize - stringLength ; i++) { spacesToAdd += " "; } } return string + spacesToAdd; }
StringWidthAdapter { String adapt(String string) { String spacesToAdd = ""; int stringLength = string.length(); if(stringLength < expectedStringSize) { for (int i = 0; i < expectedStringSize - stringLength ; i++) { spacesToAdd += " "; } } return string + spacesToAdd; } }
StringWidthAdapter { String adapt(String string) { String spacesToAdd = ""; int stringLength = string.length(); if(stringLength < expectedStringSize) { for (int i = 0; i < expectedStringSize - stringLength ; i++) { spacesToAdd += " "; } } return string + spacesToAdd; } StringWidthAdapter(int expectedStringSize); }
StringWidthAdapter { String adapt(String string) { String spacesToAdd = ""; int stringLength = string.length(); if(stringLength < expectedStringSize) { for (int i = 0; i < expectedStringSize - stringLength ; i++) { spacesToAdd += " "; } } return string + spacesToAdd; } StringWidthAdapter(int expectedStringSize);  }
StringWidthAdapter { String adapt(String string) { String spacesToAdd = ""; int stringLength = string.length(); if(stringLength < expectedStringSize) { for (int i = 0; i < expectedStringSize - stringLength ; i++) { spacesToAdd += " "; } } return string + spacesToAdd; } StringWidthAdapter(int expectedStringSize);   }