Skip to content

Commit

Permalink
REFACTORING: method rename, Boolean->boolean,
Browse files Browse the repository at this point in the history
  • Loading branch information
Janek1010 committed Feb 16, 2024
1 parent e46a5c2 commit 567e298
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public record Repository(
String name,
Owner owner,
Boolean fork,
boolean fork,
@JsonProperty("branches_url")
String branchesUrl,
List<Branch> branches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ public GithubService(GithubClient githubClient) {

public Flux<RepositoryDTO> 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<BranchDTO> getListOfBranchesDTO(Repository repository) {
public Flux<BranchDTO> getBranchesByRepository(Repository repository) {
return githubClient.getAllBranches(repository)
.map(branch -> new BranchDTO(branch.name(), branch.commit().sha()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void testGetListOfBranchesDTO() {

when(githubClient.getAllBranches(any())).thenReturn(Flux.just(branch1, branch2));

Flux<BranchDTO> branchesReturned = githubService.getListOfBranchesDTO(repositoryTested);
Flux<BranchDTO> branchesReturned = githubService.getBranchesByRepository(repositoryTested);

branchesReturned.collectList().block().forEach(branchDTO -> {
if (branchDTO.name().equals("branch1")) {
Expand Down

0 comments on commit 567e298

Please sign in to comment.