Skip to content

Commit 4943ab9

Browse files
Minor code improvement.
1 parent 269c21b commit 4943ab9

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

modules/reindex/src/test/java/org/elasticsearch/index/reindex/remote/RemoteScrollableHitSourceTests.java

+7-19
Original file line numberDiff line numberDiff line change
@@ -135,25 +135,6 @@ public void validateAllConsumed() {
135135
assertTrue(responseQueue.isEmpty());
136136
}
137137

138-
private <T> RejectAwareActionListener<T> wrapAsListener(Consumer<T> consumer) {
139-
return new RejectAwareActionListener<>() {
140-
@Override
141-
public void onRejection(Exception e) {
142-
throw new AssertionError(e);
143-
}
144-
145-
@Override
146-
public void onResponse(T t) {
147-
consumer.accept(t);
148-
}
149-
150-
@Override
151-
public void onFailure(Exception e) {
152-
throw new AssertionError(e);
153-
}
154-
};
155-
}
156-
157138
public void testLookupRemoteVersion() throws Exception {
158139
assertLookupRemoteVersion(Version.fromString("0.20.5"), "main/0_20_5.json");
159140
assertLookupRemoteVersion(Version.fromString("0.90.13"), "main/0_90_13.json");
@@ -610,6 +591,13 @@ private class TestRemoteScrollableHitSource extends RemoteScrollableHitSource {
610591
}
611592
}
612593

594+
private <T> RejectAwareActionListener<T> wrapAsListener(Consumer<T> consumer) {
595+
Consumer<Exception> throwing = e -> {
596+
throw new AssertionError(e);
597+
};
598+
return RejectAwareActionListener.wrap(consumer::accept, throwing, throwing);
599+
}
600+
613601
@SuppressWarnings("unchecked")
614602
private <T extends Exception, V> T expectListenerFailure(Class<T> expectedException, Consumer<RejectAwareActionListener<V>> subject) {
615603
AtomicReference<T> exception = new AtomicReference<>();

0 commit comments

Comments
 (0)