Skip to content

Commit

Permalink
Issue #331 - Refactor according codebeat
Browse files Browse the repository at this point in the history
  • Loading branch information
boretti committed May 31, 2020
1 parent 73734d0 commit 8e123ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
package ch.powerunit.extensions.matchers.provideprocessor;

import static ch.powerunit.extensions.matchers.common.CommonUtils.asStandardMethodName;
import static java.util.Arrays.stream;
import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toList;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Optional;
Expand Down Expand Up @@ -100,7 +100,7 @@ private Function<String, String> asJavadocFormat(String prefix) {
}

private String paramToJavadoc(Optional<String> param) {
return param.map(p -> Arrays.stream(p.split("\n"))).map(s -> s.map(asJavadocFormat(" * @param ")))
return param.map(p -> stream(p.split("\n"))).map(s -> s.map(asJavadocFormat(" * @param ")))
.map(s -> s.collect(Collectors.joining())).orElse("");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ public String getFieldCopy(String lhs, String rhs, String ignore) {
return mirror.getMatchable(containingElementMirror.getRoundMirror())
.filter(a -> mirror.getFieldTypeAsTypeElement().getTypeParameters().isEmpty())
.filter(Matchable::hasWithSameValue)
.map(p -> String.format(
.map(p -> format(
"%1$s.%6$s(%2$s.%3$s == null ? org.hamcrest.Matchers.nullValue() : %4$s(%2$s.%3$s%5$s));", lhs,
rhs, getFieldAccessor(), p.getWithSameValue(false), p.supportIgnore() ? ignore : "",
getFieldName()))
.orElseGet(() -> String.format(
.orElseGet(() -> format(
"%1$s.%4$s((org.hamcrest.Matcher)org.hamcrest.Matchers.is((java.lang.Object)%2$s.%3$s));", lhs,
rhs, getFieldAccessor(), getFieldName()));
}
Expand Down

0 comments on commit 8e123ba

Please sign in to comment.