From 567e29850ed41a21fb7773b11a9c8fb455ea0afd Mon Sep 17 00:00:00 2001 From: Janek1010 Date: Fri, 16 Feb 2024 16:54:52 +0100 Subject: [PATCH] REFACTORING: method rename, Boolean->boolean, --- .../java/org/example/githubservice/model/Repository.java | 2 +- .../org/example/githubservice/service/GithubService.java | 6 +++--- .../example/githubservice/service/GithubServiceTest.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/example/githubservice/model/Repository.java b/src/main/java/org/example/githubservice/model/Repository.java index d688564..d018f62 100644 --- a/src/main/java/org/example/githubservice/model/Repository.java +++ b/src/main/java/org/example/githubservice/model/Repository.java @@ -7,7 +7,7 @@ public record Repository( String name, Owner owner, - Boolean fork, + boolean fork, @JsonProperty("branches_url") String branchesUrl, List branches diff --git a/src/main/java/org/example/githubservice/service/GithubService.java b/src/main/java/org/example/githubservice/service/GithubService.java index a313593..f35828b 100644 --- a/src/main/java/org/example/githubservice/service/GithubService.java +++ b/src/main/java/org/example/githubservice/service/GithubService.java @@ -17,13 +17,13 @@ public GithubService(GithubClient githubClient) { public Flux getRepositoriesWithBranchesByUser(String username) { return githubClient.getAllRepositoriesByUser(username) - .filter(repositoryDTO -> !repositoryDTO.fork()) - .concatMap(repository -> getListOfBranchesDTO(repository) + .filter(repository -> !repository.fork()) + .flatMap(repository -> getBranchesByRepository(repository) .collectList() .map(branches -> new RepositoryDTO(repository.name(), repository.owner().login(), branches))); } - public Flux getListOfBranchesDTO(Repository repository) { + public Flux getBranchesByRepository(Repository repository) { return githubClient.getAllBranches(repository) .map(branch -> new BranchDTO(branch.name(), branch.commit().sha())); } diff --git a/src/test/java/org/example/githubservice/service/GithubServiceTest.java b/src/test/java/org/example/githubservice/service/GithubServiceTest.java index acd624f..e004bac 100644 --- a/src/test/java/org/example/githubservice/service/GithubServiceTest.java +++ b/src/test/java/org/example/githubservice/service/GithubServiceTest.java @@ -42,7 +42,7 @@ void testGetListOfBranchesDTO() { when(githubClient.getAllBranches(any())).thenReturn(Flux.just(branch1, branch2)); - Flux branchesReturned = githubService.getListOfBranchesDTO(repositoryTested); + Flux branchesReturned = githubService.getBranchesByRepository(repositoryTested); branchesReturned.collectList().block().forEach(branchDTO -> { if (branchDTO.name().equals("branch1")) {