### Question:
CliMain { private void cmdSnapshot() { if (arguments.size() == 1) { StreamRepository repo = readAndLockRepository(); for (String streamName : streamService.getStreamNames(repo)) { Stream stream = streamService.readStream(repo, streamName); streamService.takeSnapshot(stream); System.out.println("took snapshot of " + streamName); } } else if (arguments.size() == 2) { StreamRepository repo = readAndLockRepository(); String streamName = arguments.get(1); Stream stream = streamService.readStream(repo, streamName); streamService.takeSnapshot(stream); System.out.println("took snapshot of " + streamName); } else { throw new DisplayException("too many arguments"); } }  static void main(String... args);  }### Answer:
@Test public void testCmdSnapshot() throws Exception { Path location = createRepoLocation(); ApplicationStreamRepository repo = streamRepositoryService .createRepository(ApplicationStreamRepository.class, location); Stream stream = streamService.createStream(repo, "test"); assertThat(streamService.getSnapshots(stream).isEmpty(), is(true)); main().processCommand("-r", location.toAbsolutePath().toString(), "-sudo", "snapshot", "test"); assertThat(streamService.getSnapshots(stream).isEmpty(), is(false)); assertNull(streamService.getSnapshots(stream).get(0).senderStreamId); }