Format all Java files with google-java-format
Having a standard tool for formatting saves reviewers' valuable time. google-java-format is Google's standard formatter and is somewhat inspired by gofmt[1]. This commit formats everything using google-java-format version 1.2. The downside of this one-off formatting is breaking blame. This can be somewhat hacked around with a tool like git-hyper-blame[2], but it's definitely not optimal until/unless this kind of feature makes its way to git core. Not in this change: * Tool support, e.g. Eclipse. The command must be run manually [3]. * Documentation of best practice, e.g. new 100-column default. [1] https://talks.golang.org/2015/gofmt-en.slide#3 [2] https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-hyper-blame.html [3] git ls-files | grep java$ | xargs google-java-format -i Change-Id: Id5f3c6de95ce0b68b41f0a478b5c99a93675aaa3 Signed-off-by: David Pursehouse <dpursehouse@collab.net>
This commit is contained in:

committed by
David Pursehouse

parent
6723b6d0fa
commit
292fa154c1
@@ -24,19 +24,16 @@ import com.google.common.truth.Truth;
|
||||
|
||||
public class RangeSubject extends Subject<RangeSubject, Comment.Range> {
|
||||
|
||||
private static final SubjectFactory<RangeSubject, Comment.Range>
|
||||
RANGE_SUBJECT_FACTORY =
|
||||
private static final SubjectFactory<RangeSubject, Comment.Range> RANGE_SUBJECT_FACTORY =
|
||||
new SubjectFactory<RangeSubject, Comment.Range>() {
|
||||
@Override
|
||||
public RangeSubject getSubject(FailureStrategy failureStrategy,
|
||||
Comment.Range range) {
|
||||
public RangeSubject getSubject(FailureStrategy failureStrategy, Comment.Range range) {
|
||||
return new RangeSubject(failureStrategy, range);
|
||||
}
|
||||
};
|
||||
|
||||
public static RangeSubject assertThat(Comment.Range range) {
|
||||
return assertAbout(RANGE_SUBJECT_FACTORY)
|
||||
.that(range);
|
||||
return assertAbout(RANGE_SUBJECT_FACTORY).that(range);
|
||||
}
|
||||
|
||||
private RangeSubject(FailureStrategy failureStrategy, Comment.Range range) {
|
||||
|
@@ -25,23 +25,20 @@ import com.google.gerrit.truth.ListSubject;
|
||||
|
||||
public class CommitInfoSubject extends Subject<CommitInfoSubject, CommitInfo> {
|
||||
|
||||
private static final SubjectFactory<CommitInfoSubject, CommitInfo>
|
||||
COMMIT_INFO_SUBJECT_FACTORY =
|
||||
private static final SubjectFactory<CommitInfoSubject, CommitInfo> COMMIT_INFO_SUBJECT_FACTORY =
|
||||
new SubjectFactory<CommitInfoSubject, CommitInfo>() {
|
||||
@Override
|
||||
public CommitInfoSubject getSubject(FailureStrategy failureStrategy,
|
||||
CommitInfo commitInfo) {
|
||||
public CommitInfoSubject getSubject(
|
||||
FailureStrategy failureStrategy, CommitInfo commitInfo) {
|
||||
return new CommitInfoSubject(failureStrategy, commitInfo);
|
||||
}
|
||||
};
|
||||
|
||||
public static CommitInfoSubject assertThat(CommitInfo commitInfo) {
|
||||
return assertAbout(COMMIT_INFO_SUBJECT_FACTORY)
|
||||
.that(commitInfo);
|
||||
return assertAbout(COMMIT_INFO_SUBJECT_FACTORY).that(commitInfo);
|
||||
}
|
||||
|
||||
private CommitInfoSubject(FailureStrategy failureStrategy,
|
||||
CommitInfo commitInfo) {
|
||||
private CommitInfoSubject(FailureStrategy failureStrategy, CommitInfo commitInfo) {
|
||||
super(failureStrategy, commitInfo);
|
||||
}
|
||||
|
||||
@@ -54,8 +51,8 @@ public class CommitInfoSubject extends Subject<CommitInfoSubject, CommitInfo> {
|
||||
public ListSubject<CommitInfoSubject, CommitInfo> parents() {
|
||||
isNotNull();
|
||||
CommitInfo commitInfo = actual();
|
||||
return ListSubject.assertThat(commitInfo.parents,
|
||||
CommitInfoSubject::assertThat).named("parents");
|
||||
return ListSubject.assertThat(commitInfo.parents, CommitInfoSubject::assertThat)
|
||||
.named("parents");
|
||||
}
|
||||
|
||||
public GitPersonSubject committer() {
|
||||
|
@@ -22,30 +22,25 @@ import com.google.common.truth.Subject;
|
||||
import com.google.common.truth.SubjectFactory;
|
||||
import com.google.common.truth.Truth;
|
||||
import com.google.gerrit.truth.OptionalSubject;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class EditInfoSubject extends Subject<EditInfoSubject, EditInfo> {
|
||||
|
||||
private static final SubjectFactory<EditInfoSubject, EditInfo>
|
||||
EDIT_INFO_SUBJECT_FACTORY =
|
||||
private static final SubjectFactory<EditInfoSubject, EditInfo> EDIT_INFO_SUBJECT_FACTORY =
|
||||
new SubjectFactory<EditInfoSubject, EditInfo>() {
|
||||
@Override
|
||||
public EditInfoSubject getSubject(FailureStrategy failureStrategy,
|
||||
EditInfo editInfo) {
|
||||
public EditInfoSubject getSubject(FailureStrategy failureStrategy, EditInfo editInfo) {
|
||||
return new EditInfoSubject(failureStrategy, editInfo);
|
||||
}
|
||||
};
|
||||
|
||||
public static EditInfoSubject assertThat(EditInfo editInfo) {
|
||||
return assertAbout(EDIT_INFO_SUBJECT_FACTORY)
|
||||
.that(editInfo);
|
||||
return assertAbout(EDIT_INFO_SUBJECT_FACTORY).that(editInfo);
|
||||
}
|
||||
|
||||
public static OptionalSubject<EditInfoSubject, EditInfo> assertThat(
|
||||
Optional<EditInfo> editInfoOptional) {
|
||||
return OptionalSubject.assertThat(editInfoOptional,
|
||||
EditInfoSubject::assertThat);
|
||||
return OptionalSubject.assertThat(editInfoOptional, EditInfoSubject::assertThat);
|
||||
}
|
||||
|
||||
private EditInfoSubject(FailureStrategy failureStrategy, EditInfo editInfo) {
|
||||
|
@@ -26,26 +26,22 @@ import com.google.gerrit.extensions.client.RangeSubject;
|
||||
public class FixReplacementInfoSubject
|
||||
extends Subject<FixReplacementInfoSubject, FixReplacementInfo> {
|
||||
|
||||
private static final SubjectFactory<FixReplacementInfoSubject,
|
||||
FixReplacementInfo> FIX_REPLACEMENT_INFO_SUBJECT_FACTORY =
|
||||
new SubjectFactory<FixReplacementInfoSubject, FixReplacementInfo>() {
|
||||
@Override
|
||||
public FixReplacementInfoSubject getSubject(
|
||||
FailureStrategy failureStrategy,
|
||||
FixReplacementInfo fixReplacementInfo) {
|
||||
return new FixReplacementInfoSubject(failureStrategy,
|
||||
fixReplacementInfo);
|
||||
}
|
||||
};
|
||||
private static final SubjectFactory<FixReplacementInfoSubject, FixReplacementInfo>
|
||||
FIX_REPLACEMENT_INFO_SUBJECT_FACTORY =
|
||||
new SubjectFactory<FixReplacementInfoSubject, FixReplacementInfo>() {
|
||||
@Override
|
||||
public FixReplacementInfoSubject getSubject(
|
||||
FailureStrategy failureStrategy, FixReplacementInfo fixReplacementInfo) {
|
||||
return new FixReplacementInfoSubject(failureStrategy, fixReplacementInfo);
|
||||
}
|
||||
};
|
||||
|
||||
public static FixReplacementInfoSubject assertThat(
|
||||
FixReplacementInfo fixReplacementInfo) {
|
||||
return assertAbout(FIX_REPLACEMENT_INFO_SUBJECT_FACTORY)
|
||||
.that(fixReplacementInfo);
|
||||
public static FixReplacementInfoSubject assertThat(FixReplacementInfo fixReplacementInfo) {
|
||||
return assertAbout(FIX_REPLACEMENT_INFO_SUBJECT_FACTORY).that(fixReplacementInfo);
|
||||
}
|
||||
|
||||
private FixReplacementInfoSubject(FailureStrategy failureStrategy,
|
||||
FixReplacementInfo fixReplacementInfo) {
|
||||
private FixReplacementInfoSubject(
|
||||
FailureStrategy failureStrategy, FixReplacementInfo fixReplacementInfo) {
|
||||
super(failureStrategy, fixReplacementInfo);
|
||||
}
|
||||
|
||||
|
@@ -23,29 +23,24 @@ import com.google.common.truth.SubjectFactory;
|
||||
import com.google.common.truth.Truth;
|
||||
import com.google.gerrit.truth.ListSubject;
|
||||
|
||||
public class FixSuggestionInfoSubject
|
||||
extends Subject<FixSuggestionInfoSubject, FixSuggestionInfo> {
|
||||
public class FixSuggestionInfoSubject extends Subject<FixSuggestionInfoSubject, FixSuggestionInfo> {
|
||||
|
||||
private static final SubjectFactory<FixSuggestionInfoSubject,
|
||||
FixSuggestionInfo> FIX_SUGGESTION_INFO_SUBJECT_FACTORY =
|
||||
new SubjectFactory<FixSuggestionInfoSubject, FixSuggestionInfo>() {
|
||||
@Override
|
||||
public FixSuggestionInfoSubject getSubject(
|
||||
FailureStrategy failureStrategy,
|
||||
FixSuggestionInfo fixSuggestionInfo) {
|
||||
return new FixSuggestionInfoSubject(failureStrategy,
|
||||
fixSuggestionInfo);
|
||||
}
|
||||
};
|
||||
private static final SubjectFactory<FixSuggestionInfoSubject, FixSuggestionInfo>
|
||||
FIX_SUGGESTION_INFO_SUBJECT_FACTORY =
|
||||
new SubjectFactory<FixSuggestionInfoSubject, FixSuggestionInfo>() {
|
||||
@Override
|
||||
public FixSuggestionInfoSubject getSubject(
|
||||
FailureStrategy failureStrategy, FixSuggestionInfo fixSuggestionInfo) {
|
||||
return new FixSuggestionInfoSubject(failureStrategy, fixSuggestionInfo);
|
||||
}
|
||||
};
|
||||
|
||||
public static FixSuggestionInfoSubject assertThat(
|
||||
FixSuggestionInfo fixSuggestionInfo) {
|
||||
return assertAbout(FIX_SUGGESTION_INFO_SUBJECT_FACTORY)
|
||||
.that(fixSuggestionInfo);
|
||||
public static FixSuggestionInfoSubject assertThat(FixSuggestionInfo fixSuggestionInfo) {
|
||||
return assertAbout(FIX_SUGGESTION_INFO_SUBJECT_FACTORY).that(fixSuggestionInfo);
|
||||
}
|
||||
|
||||
private FixSuggestionInfoSubject(FailureStrategy failureStrategy,
|
||||
FixSuggestionInfo fixSuggestionInfo) {
|
||||
private FixSuggestionInfoSubject(
|
||||
FailureStrategy failureStrategy, FixSuggestionInfo fixSuggestionInfo) {
|
||||
super(failureStrategy, fixSuggestionInfo);
|
||||
}
|
||||
|
||||
@@ -53,10 +48,9 @@ public class FixSuggestionInfoSubject
|
||||
return Truth.assertThat(actual().fixId).named("fixId");
|
||||
}
|
||||
|
||||
public ListSubject<FixReplacementInfoSubject,
|
||||
FixReplacementInfo> replacements() {
|
||||
return ListSubject.assertThat(actual().replacements,
|
||||
FixReplacementInfoSubject::assertThat).named("replacements");
|
||||
public ListSubject<FixReplacementInfoSubject, FixReplacementInfo> replacements() {
|
||||
return ListSubject.assertThat(actual().replacements, FixReplacementInfoSubject::assertThat)
|
||||
.named("replacements");
|
||||
}
|
||||
|
||||
public FixReplacementInfoSubject onlyReplacement() {
|
||||
|
@@ -21,28 +21,23 @@ import com.google.common.truth.FailureStrategy;
|
||||
import com.google.common.truth.Subject;
|
||||
import com.google.common.truth.SubjectFactory;
|
||||
import com.google.common.truth.Truth;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class GitPersonSubject extends Subject<GitPersonSubject, GitPerson> {
|
||||
|
||||
private static final SubjectFactory<GitPersonSubject, GitPerson>
|
||||
GIT_PERSON_SUBJECT_FACTORY =
|
||||
private static final SubjectFactory<GitPersonSubject, GitPerson> GIT_PERSON_SUBJECT_FACTORY =
|
||||
new SubjectFactory<GitPersonSubject, GitPerson>() {
|
||||
@Override
|
||||
public GitPersonSubject getSubject(FailureStrategy failureStrategy,
|
||||
GitPerson gitPerson) {
|
||||
public GitPersonSubject getSubject(FailureStrategy failureStrategy, GitPerson gitPerson) {
|
||||
return new GitPersonSubject(failureStrategy, gitPerson);
|
||||
}
|
||||
};
|
||||
|
||||
public static GitPersonSubject assertThat(GitPerson gitPerson) {
|
||||
return assertAbout(GIT_PERSON_SUBJECT_FACTORY)
|
||||
.that(gitPerson);
|
||||
return assertAbout(GIT_PERSON_SUBJECT_FACTORY).that(gitPerson);
|
||||
}
|
||||
|
||||
private GitPersonSubject(FailureStrategy failureStrategy,
|
||||
GitPerson gitPerson) {
|
||||
private GitPersonSubject(FailureStrategy failureStrategy, GitPerson gitPerson) {
|
||||
super(failureStrategy, gitPerson);
|
||||
}
|
||||
|
||||
|
@@ -20,45 +20,38 @@ import com.google.common.truth.FailureStrategy;
|
||||
import com.google.common.truth.Subject;
|
||||
import com.google.common.truth.SubjectFactory;
|
||||
import com.google.gerrit.truth.ListSubject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RobotCommentInfoSubject
|
||||
extends Subject<RobotCommentInfoSubject, RobotCommentInfo> {
|
||||
public class RobotCommentInfoSubject extends Subject<RobotCommentInfoSubject, RobotCommentInfo> {
|
||||
|
||||
private static final SubjectFactory<RobotCommentInfoSubject, RobotCommentInfo>
|
||||
ROBOT_COMMENT_INFO_SUBJECT_FACTORY =
|
||||
new SubjectFactory<RobotCommentInfoSubject, RobotCommentInfo>() {
|
||||
@Override
|
||||
public RobotCommentInfoSubject getSubject(
|
||||
FailureStrategy failureStrategy,
|
||||
RobotCommentInfo robotCommentInfo) {
|
||||
return new RobotCommentInfoSubject(failureStrategy, robotCommentInfo);
|
||||
}
|
||||
};
|
||||
new SubjectFactory<RobotCommentInfoSubject, RobotCommentInfo>() {
|
||||
@Override
|
||||
public RobotCommentInfoSubject getSubject(
|
||||
FailureStrategy failureStrategy, RobotCommentInfo robotCommentInfo) {
|
||||
return new RobotCommentInfoSubject(failureStrategy, robotCommentInfo);
|
||||
}
|
||||
};
|
||||
|
||||
public static ListSubject<RobotCommentInfoSubject,
|
||||
RobotCommentInfo> assertThatList(
|
||||
List<RobotCommentInfo> robotCommentInfos) {
|
||||
return ListSubject.assertThat(robotCommentInfos,
|
||||
RobotCommentInfoSubject::assertThat).named("robotCommentInfos");
|
||||
public static ListSubject<RobotCommentInfoSubject, RobotCommentInfo> assertThatList(
|
||||
List<RobotCommentInfo> robotCommentInfos) {
|
||||
return ListSubject.assertThat(robotCommentInfos, RobotCommentInfoSubject::assertThat)
|
||||
.named("robotCommentInfos");
|
||||
}
|
||||
|
||||
public static RobotCommentInfoSubject assertThat(
|
||||
RobotCommentInfo robotCommentInfo) {
|
||||
return assertAbout(ROBOT_COMMENT_INFO_SUBJECT_FACTORY)
|
||||
.that(robotCommentInfo);
|
||||
public static RobotCommentInfoSubject assertThat(RobotCommentInfo robotCommentInfo) {
|
||||
return assertAbout(ROBOT_COMMENT_INFO_SUBJECT_FACTORY).that(robotCommentInfo);
|
||||
}
|
||||
|
||||
private RobotCommentInfoSubject(FailureStrategy failureStrategy,
|
||||
RobotCommentInfo robotCommentInfo) {
|
||||
private RobotCommentInfoSubject(
|
||||
FailureStrategy failureStrategy, RobotCommentInfo robotCommentInfo) {
|
||||
super(failureStrategy, robotCommentInfo);
|
||||
}
|
||||
|
||||
public ListSubject<FixSuggestionInfoSubject,
|
||||
FixSuggestionInfo> fixSuggestions() {
|
||||
return ListSubject.assertThat(actual().fixSuggestions,
|
||||
FixSuggestionInfoSubject::assertThat).named("fixSuggestions");
|
||||
public ListSubject<FixSuggestionInfoSubject, FixSuggestionInfo> fixSuggestions() {
|
||||
return ListSubject.assertThat(actual().fixSuggestions, FixSuggestionInfoSubject::assertThat)
|
||||
.named("fixSuggestions");
|
||||
}
|
||||
|
||||
public FixSuggestionInfoSubject onlyFixSuggestion() {
|
||||
|
@@ -22,38 +22,32 @@ import com.google.common.truth.Subject;
|
||||
import com.google.common.truth.SubjectFactory;
|
||||
import com.google.common.truth.Truth;
|
||||
import com.google.gerrit.truth.OptionalSubject;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
|
||||
public class BinaryResultSubject
|
||||
extends Subject<BinaryResultSubject, BinaryResult> {
|
||||
public class BinaryResultSubject extends Subject<BinaryResultSubject, BinaryResult> {
|
||||
|
||||
private static final SubjectFactory<BinaryResultSubject, BinaryResult>
|
||||
BINARY_RESULT_SUBJECT_FACTORY =
|
||||
new SubjectFactory<BinaryResultSubject, BinaryResult>() {
|
||||
@Override
|
||||
public BinaryResultSubject getSubject(FailureStrategy failureStrategy,
|
||||
BinaryResult binaryResult) {
|
||||
return new BinaryResultSubject(failureStrategy,
|
||||
binaryResult);
|
||||
}
|
||||
};
|
||||
new SubjectFactory<BinaryResultSubject, BinaryResult>() {
|
||||
@Override
|
||||
public BinaryResultSubject getSubject(
|
||||
FailureStrategy failureStrategy, BinaryResult binaryResult) {
|
||||
return new BinaryResultSubject(failureStrategy, binaryResult);
|
||||
}
|
||||
};
|
||||
|
||||
public static BinaryResultSubject assertThat(BinaryResult binaryResult) {
|
||||
return assertAbout(BINARY_RESULT_SUBJECT_FACTORY)
|
||||
.that(binaryResult);
|
||||
return assertAbout(BINARY_RESULT_SUBJECT_FACTORY).that(binaryResult);
|
||||
}
|
||||
|
||||
public static OptionalSubject<BinaryResultSubject, BinaryResult> assertThat(
|
||||
Optional<BinaryResult> binaryResultOptional) {
|
||||
return OptionalSubject.assertThat(binaryResultOptional,
|
||||
BinaryResultSubject::assertThat);
|
||||
return OptionalSubject.assertThat(binaryResultOptional, BinaryResultSubject::assertThat);
|
||||
}
|
||||
|
||||
private BinaryResultSubject(FailureStrategy failureStrategy,
|
||||
BinaryResult binaryResult) {
|
||||
private BinaryResultSubject(FailureStrategy failureStrategy, BinaryResult binaryResult) {
|
||||
super(failureStrategy, binaryResult);
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,6 @@ import com.google.common.truth.FailureStrategy;
|
||||
import com.google.common.truth.IterableSubject;
|
||||
import com.google.common.truth.Subject;
|
||||
import com.google.common.truth.SubjectFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -34,12 +33,12 @@ public class ListSubject<S extends Subject<S, E>, E> extends IterableSubject {
|
||||
List<E> list, Function<E, S> elementAssertThatFunction) {
|
||||
// The ListSubjectFactory always returns ListSubjects.
|
||||
// -> Casting is appropriate.
|
||||
return (ListSubject<S, E>) assertAbout(
|
||||
new ListSubjectFactory<>(elementAssertThatFunction)).that(list);
|
||||
return (ListSubject<S, E>)
|
||||
assertAbout(new ListSubjectFactory<>(elementAssertThatFunction)).that(list);
|
||||
}
|
||||
|
||||
private ListSubject(FailureStrategy failureStrategy, List<E> list,
|
||||
Function<E, S> elementAssertThatFunction) {
|
||||
private ListSubject(
|
||||
FailureStrategy failureStrategy, List<E> list, Function<E, S> elementAssertThatFunction) {
|
||||
super(failureStrategy, list);
|
||||
this.elementAssertThatFunction = elementAssertThatFunction;
|
||||
}
|
||||
@@ -82,12 +81,10 @@ public class ListSubject<S extends Subject<S, E>, E> extends IterableSubject {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public ListSubject<S, T> getSubject(FailureStrategy failureStrategy,
|
||||
Iterable<?> objects) {
|
||||
public ListSubject<S, T> getSubject(FailureStrategy failureStrategy, Iterable<?> objects) {
|
||||
// The constructor of ListSubject only accepts lists.
|
||||
// -> Casting is appropriate.
|
||||
return new ListSubject<>(failureStrategy, (List<T>) objects,
|
||||
elementAssertThatFunction);
|
||||
return new ListSubject<>(failureStrategy, (List<T>) objects, elementAssertThatFunction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@ import com.google.common.truth.FailureStrategy;
|
||||
import com.google.common.truth.Subject;
|
||||
import com.google.common.truth.SubjectFactory;
|
||||
import com.google.common.truth.Truth;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -30,16 +29,14 @@ public class OptionalSubject<S extends Subject<S, ? super T>, T>
|
||||
|
||||
private final Function<? super T, ? extends S> valueAssertThatFunction;
|
||||
|
||||
public static <S extends Subject<S, ? super T>, T> OptionalSubject<S, T>
|
||||
assertThat(Optional<T> optional,
|
||||
Function<? super T, ? extends S> elementAssertThatFunction) {
|
||||
public static <S extends Subject<S, ? super T>, T> OptionalSubject<S, T> assertThat(
|
||||
Optional<T> optional, Function<? super T, ? extends S> elementAssertThatFunction) {
|
||||
OptionalSubjectFactory<S, T> optionalSubjectFactory =
|
||||
new OptionalSubjectFactory<>(elementAssertThatFunction);
|
||||
return assertAbout(optionalSubjectFactory).that(optional);
|
||||
}
|
||||
|
||||
public static OptionalSubject<DefaultSubject, ?> assertThat(
|
||||
Optional<?> optional) {
|
||||
public static OptionalSubject<DefaultSubject, ?> assertThat(Optional<?> optional) {
|
||||
// Unfortunately, we need to cast to DefaultSubject as Truth.assertThat()
|
||||
// only returns Subject<DefaultSubject, Object>. There shouldn't be a way
|
||||
// for that method not to return a DefaultSubject because the generic type
|
||||
@@ -49,7 +46,9 @@ public class OptionalSubject<S extends Subject<S, ? super T>, T>
|
||||
return assertThat(optional, valueAssertThatFunction);
|
||||
}
|
||||
|
||||
private OptionalSubject(FailureStrategy failureStrategy, Optional<T> optional,
|
||||
private OptionalSubject(
|
||||
FailureStrategy failureStrategy,
|
||||
Optional<T> optional,
|
||||
Function<? super T, ? extends S> valueAssertThatFunction) {
|
||||
super(failureStrategy, optional);
|
||||
this.valueAssertThatFunction = valueAssertThatFunction;
|
||||
@@ -82,22 +81,18 @@ public class OptionalSubject<S extends Subject<S, ? super T>, T>
|
||||
return valueAssertThatFunction.apply(optional.get());
|
||||
}
|
||||
|
||||
private static class OptionalSubjectFactory<S extends Subject<S, ? super T>,
|
||||
T> extends SubjectFactory<OptionalSubject<S, T>, Optional<T>> {
|
||||
private static class OptionalSubjectFactory<S extends Subject<S, ? super T>, T>
|
||||
extends SubjectFactory<OptionalSubject<S, T>, Optional<T>> {
|
||||
|
||||
private Function<? super T, ? extends S> valueAssertThatFunction;
|
||||
|
||||
OptionalSubjectFactory(
|
||||
Function<? super T, ? extends S> valueAssertThatFunction) {
|
||||
OptionalSubjectFactory(Function<? super T, ? extends S> valueAssertThatFunction) {
|
||||
this.valueAssertThatFunction = valueAssertThatFunction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OptionalSubject<S, T> getSubject(FailureStrategy failureStrategy,
|
||||
Optional<T> optional) {
|
||||
return new OptionalSubject<>(failureStrategy, optional,
|
||||
valueAssertThatFunction);
|
||||
public OptionalSubject<S, T> getSubject(FailureStrategy failureStrategy, Optional<T> optional) {
|
||||
return new OptionalSubject<>(failureStrategy, optional, valueAssertThatFunction);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user