BranchService { public Branch createBranch(Repository repository, String branchName, User createdByUser) { logger.debug("createBranch, name: {}, repository id: {}", branchName, repository.getId()); Branch branch = new Branch(); branch.setName(branchName); branch.setRepository(repository); branch.setCreatedByUser(createdByUser); branch = branchRepository.save(branch); return branch; }  Branch createBranch(Repository repository, String branchName, User createdByUser); Branch getUndeletedOrCreateBranch(Repository repository, String branchName, User createdByUser); void undeleteBranch(Branch branch); PollableFuture<Void> asyncDeleteBranch(Long repositoryId, Long branchId); @Transactional void deleteBranch(Long repositoryId, Long branchId); void deleteBranchAsset(Long branchId, Long repositoryId);  }
@Test public void createBranch() throws RepositoryNameAlreadyUsedException { Repository repository = repositoryService.createRepository(testIdWatcher.getEntityName("repository")); Branch master = branchService.createBranch(repository, "master", null); Branch fromFind = branchRepository.findByNameAndRepository("master", repository); assertEquals("master", fromFind.getName()); assertEquals(repository.getId(), fromFind.getRepository().getId()); }