### Question:
StringContainer { public StringContainer getSubStringContainer(int start, int end) { int realStartIndex = start >= 0 ? start : count + start; int realEndIndex = end >= 0 ? end : count + end; if (realStartIndex < 0 || realStartIndex >= count) { throw new IndexOutOfBoundsException( "start Index: " + start + ", Real start Index: " + realStartIndex + ", Size: " + count); } if (realEndIndex < 0 || realEndIndex >= count) { throw new IndexOutOfBoundsException( "end Index: " + end + ", Real end Index: " + realEndIndex + ", Size: " + count); } StringContainer ret = new StringContainer(joinSeparator); if (realStartIndex < reverseList.size()) { for (int i = reverseList.size() - 1 - realStartIndex; i >= Math.max(0, reverseList.size() - 1 - realEndIndex); i--) { ret.addTail(this.reverseList.get(i)); } } if (realEndIndex >= reverseList.size()) { for (int i = Math.max(0, realStartIndex - reverseList.size()); i <= realEndIndex - reverseList.size(); i++) { ret.addTail(this.sequenceList.get(i)); } } return ret; } StringContainer();  StringContainer(String joinSeparator);  StringContainer(String[] strings);  StringContainer(String[] strings, String joinSeparator); int size(); int length(); ArrayList<String> getSequenceList(); ArrayList<String> getReverseList(); StringContainer addTail(Object... objs); StringContainer addTail(String... strings); StringContainer addTail(StringContainer myContainer); StringContainer addHead(String... strings); StringContainer addHead(StringContainer myContainer); @Override String toString(); String join(String separator); String getSubString(int index); StringContainer getSubStringContainer(int start, int end); @Override int hashCode(); @Override boolean equals(Object sc); boolean equals(StringContainer sc); @Override StringContainer clone();  }### Answer:
@Test public void testGetSubStringContainer() { StringContainer a = new StringContainer(); try { a.getSubStringContainer(0, 1); } catch (Exception e) { assertTrue(e instanceof IndexOutOfBoundsException); } a.addTail("a", "bbb", "cc"); assertEquals("", a.getSubStringContainer(1, 0).toString()); assertEquals("a", a.getSubStringContainer(0, 0).toString()); assertEquals("bbbcc", a.getSubStringContainer(1, -1).toString()); assertEquals("bbb", a.getSubStringContainer(-2, -2).toString()); try { a.getSubStringContainer(1, 4); } catch (Exception e) { assertTrue(e instanceof IndexOutOfBoundsException); } a.addHead("dd", "eeee"); assertEquals("eeeea", a.getSubStringContainer(1, 2).toString()); assertEquals("eeeea", a.getSubStringContainer(1, -3).toString()); assertEquals("dd", a.getSubStringContainer(0, 0).toString()); assertEquals("cc", a.getSubStringContainer(-1, -1).toString()); assertEquals("ddeeeeabbbcc", a.getSubStringContainer(-5, -1).toString()); try { a.getSubString(9); } catch (Exception e) { assertTrue(e instanceof IndexOutOfBoundsException); } }