Input { public String substring(int from, int to) { StringBuilder sb = new StringBuilder(); for (int i = from; i < to; i++) { sb.append(inputChars[i]); } return sb.toString(); } Input(char[] input);  Input(char[] input, URI uri); char[] input(); URI uri(); String substring(int from, int to); int[] lineAndColumnAt(int index);  }
@Test public void substring() { Input input = new Input("abc".toCharArray()); assertThat(input.substring(0, 3)).isEqualTo("abc"); assertThat(input.substring(0, 2)).isEqualTo("ab"); assertThat(input.substring(0, 1)).isEqualTo("a"); assertThat(input.substring(0, 0)).isEqualTo(""); assertThat(input.substring(1, 3)).isEqualTo("bc"); assertThat(input.substring(2, 3)).isEqualTo("c"); assertThat(input.substring(3, 3)).isEqualTo(""); }