### Question:
RemoteChangesetVersionCommand extends AbstractCallableCommand<Integer, Exception> { public String parse(Reader consoleReader) throws ParseException, IOException { TextTableParser parser = new TextTableParser(new BufferedReader(consoleReader), 1); while (parser.nextRow()) { return parser.getColumn(0); } return StringUtils.EMPTY; } RemoteChangesetVersionCommand(
            final ServerConfigurationProvider server, final String remotePath, final VersionSpec versionSpec); Callable<Integer, Exception> getCallable(); Integer call(); static String toString(final VersionSpec versionSpec); String parse(Reader consoleReader);  }### Answer:
@Test public void assertChangesWithEmptyToolOutput() throws Exception { RemoteChangesetVersionCommand command = new RemoteChangesetVersionCommand(mock(Server.class), "$/tfsandbox", fixedPointInTime); StringReader reader = new StringReader("No history entries were found for the item and version combination specified.\n\n"); String changesetNumber = command.parse(reader); assertEquals("Change set number was incorrect", "", changesetNumber); }
@Test public void assertChangesWithChangeOutput() throws Exception { StringReader reader = new StringReader( "Changeset User Date Comment\n" + "--------- -------------- -------------------- ----------------------------------------------------------------------------\n" + "\n" + "12495 SND\\redsolo_cp 2008-jun-27 13:21:25 changed and created one\n"); RemoteChangesetVersionCommand command = new RemoteChangesetVersionCommand(mock(Server.class), "$/tfsandbox", fixedPointInTime); String changesetNumber = command.parse(reader); assertEquals("Change set number was incorrect", "12495", changesetNumber); }
@Test public void assertChangesWithNoComment() throws Exception { StringReader reader = new StringReader( "Changeset User Date Comment\n" + "--------- -------------- -------------------- ----------------------------------------------------------------------------\n" + "\n" + "12495 SND\\redsolo_cp 2008-jun-27 13:21:25\n"); RemoteChangesetVersionCommand command = new RemoteChangesetVersionCommand(mock(Server.class), "$/tfsandbox", fixedPointInTime); String changesetNumber = command.parse(reader); assertEquals("Change set number was incorrect", "12495", changesetNumber); }
@Test public void assertChangesNoEmptyLine() throws Exception { StringReader reader = new StringReader( "Changeset User Date Comment\n" + "--------- -------------- -------------------- ----------------------------------------------------------------------------\n" + "12497 SND\\redsolo_cp 2008-jun-27 13:21:25\n"); RemoteChangesetVersionCommand command = new RemoteChangesetVersionCommand(mock(Server.class), "$/tfsandbox", fixedPointInTime); String changesetNumber = command.parse(reader); assertEquals("Change set number was incorrect", "12497", changesetNumber); }
@Test public void assertNoChangesWithEmptyOutput() throws Exception { RemoteChangesetVersionCommand command = new RemoteChangesetVersionCommand(mock(Server.class), "$/tfsandbox", fixedPointInTime); String changesetNumber = command.parse(new StringReader("")); assertEquals("Change set number was incorrect", "", changesetNumber); }