Rename method

This commit is contained in:
Rene Pfeuffer
2019-11-11 16:50:39 +01:00
parent 8e4606cff1
commit f7e42db850
6 changed files with 10 additions and 10 deletions

View File

@@ -84,7 +84,7 @@ public class GitBranchCommand extends AbstractGitCommand implements BranchComman
}
@Override
public void delete(String branchName) {
public void deleteOrClose(String branchName) {
try (Git gitRepo = new Git(context.open())) {
RepositoryHookEvent hookEvent = createBranchHookEvent(BranchHookContextProvider.deleteHookEvent(branchName));
eventBus.post(new PreReceiveRepositoryHookEvent(hookEvent));

View File

@@ -73,14 +73,14 @@ public class GitBranchCommandTest extends AbstractGitCommandTestBase {
public void shouldDeleteBranch() throws IOException {
GitContext context = createContext();
String branchToBeDeleted = "squash";
createCommand().delete(branchToBeDeleted);
createCommand().deleteOrClose(branchToBeDeleted);
assertThat(readBranches(context)).filteredOn(b -> b.getName().equals(branchToBeDeleted)).isEmpty();
}
@Test
public void shouldThrowInternalRepositoryException() {
String branchToBeDeleted = "master";
assertThrows(InternalRepositoryException.class, () -> createCommand().delete(branchToBeDeleted));
assertThrows(InternalRepositoryException.class, () -> createCommand().deleteOrClose(branchToBeDeleted));
}
private GitBranchCommand createCommand() {
@@ -118,7 +118,7 @@ public class GitBranchCommandTest extends AbstractGitCommandTestBase {
doNothing().when(eventBus).post(captor.capture());
when(hookContextFactory.createContext(any(), any())).thenAnswer(this::createMockedContext);
createCommand().delete("squash");
createCommand().deleteOrClose("squash");
List<Object> events = captor.getAllValues();
assertThat(events.get(0)).isInstanceOf(PreReceiveRepositoryHookEvent.class);