### Question:
CommandArguments { public String nextScope(char scopeBegin, char scopeEnd) { checkArgument(isNextUnescaped(scopeBegin), "The next character must indicate a scope begin to parse the next scope"); next(); StringBuilder builder = new StringBuilder(); int openScopes = 1; while (hasNext()) { if (isNextUnescaped(scopeEnd) && --openScopes == 0) { next(); break; } else if (isNextUnescaped(scopeBegin)) { ++openScopes; } builder.append(next()); } skipLeadingWhitespace(); return builder.toString().trim(); } protected  CommandArguments(@Nonnull String arguments, char stringDelimiter); @Nonnull static CommandArguments of(@Nonnull String arguments); @Nonnull static CommandArguments of(@Nonnull String arguments, char stringDelimiter); @Nonnull static CommandArguments singleString(@Nonnull String string); @Nonnull static CommandArguments singleString(@Nonnull String string, char stringDelimiter); int indexOfWord(String word); int indexOf(String substring); char charAt(int position); String nextScope(char scopeBegin, char scopeEnd); String nextString(); String nextWord(); String nextSection(char delimiter); void skipLeadingWhitespace(); boolean isNextUnescaped(char c); boolean isNextWhiteSpace(); String remaining(); boolean hasNext(); char next(); char peek(); char peek(int delta); char previous(); void resetPosition(); int position(); void setPosition(int position); int getRawCursor(); char getStringDelimiter(); int length(); @Override String toString(); @Nonnull String getRaw(); static final char DEFAULT_STRING_DELIMITER; }### Answer:
@Test void testNextScope() { while (arguments.hasNext() && arguments.peek() != '(') { arguments.next(); } String scope = arguments.nextScope('(', ')'); assertEquals("sed (d)", scope, "nextScope() did not return the next scope correctly"); }