Skip to content

Commit

Permalink
test: refactor JHipsterTestModuleResourceBuilder.build() code to be m…
Browse files Browse the repository at this point in the history
…ore elegant
  • Loading branch information
renanfranca committed Jan 14, 2025
1 parent a7eebb1 commit 24f4748
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import tech.jhipster.lite.module.domain.JHipsterModuleFactory;
import tech.jhipster.lite.module.domain.resource.JHipsterModuleOrganization.JHipsterModuleOrganizationBuilder;
import tech.jhipster.lite.module.domain.resource.JHipsterModuleTags.JHipsterModuleTagsBuilder;
Expand Down Expand Up @@ -145,11 +146,7 @@ public JHipsterModuleResource build() {
.organization(buildOrganization())
.tags(tags);

if (rank != null) {
builder.rank(rank);
}

return builder.factory(factory);
return Optional.ofNullable(rank).map(builder::rank).orElse(builder).factory(factory);
}

private JHipsterModuleOrganization buildOrganization() {
Expand Down

0 comments on commit 24f4748

Please sign in to comment.