### Question:
AbstractCommand implements Command, Runnable { protected Repository createRepository(String repoPath) throws IOException { return gitUtils.createRepository( new File( ctx.configuration().getRepositoriesHomeDir(), repoPath ) ); } AbstractCommand(Context ctx); abstract C command(String command); @Override void setInputStream(InputStream in); @Override void setOutputStream(OutputStream out); @Override void setErrorStream(OutputStream err); @Override void setExitCallback(ExitCallback callback); @Override void start(Environment env); void addEndCallback(EndCallback<C> callback); @Override void destroy();  }### Answer:
@Test public void testCreateRepository_nominal() throws IOException { given(ctx.configuration().getRepositoriesHomeDir()).willReturn(new File("/tmp")); new FakeCommand(ctx).createRepository("r1"); ArgumentCaptor<File> where = ArgumentCaptor.forClass(File.class); verify(ctx.getGitUtils()).createRepository(where.capture()); assertThat(where.getValue().getAbsolutePath()).isEqualTo("/tmp/r1"); }
@Test public void testCreateRepository_absurd() throws IOException { given(ctx.configuration().getRepositoriesHomeDir()).willReturn(new File("/tmp")); new FakeCommand(ctx).createRepository(" ArgumentCaptor<File> where = ArgumentCaptor.forClass(File.class); verify(ctx.getGitUtils()).createRepository(where.capture()); assertThat(where.getValue().getAbsolutePath()).isEqualTo("/tmp/r1"); }
@Test public void testCreateRepository_default() throws IOException { given(ctx.configuration().getRepositoriesHomeDir()).willReturn(new File("/tmp")); new FakeCommand(ctx).createRepository("/r1"); ArgumentCaptor<File> where = ArgumentCaptor.forClass(File.class); verify(ctx.getGitUtils()).createRepository(where.capture()); assertThat(where.getValue().getAbsolutePath()).isEqualTo("/tmp/r1"); }